Instantly share code, notes, and snippets.

View ViewController.Swift
import UIKit
import CoreLocation
class ViewController: UIViewController, CLLocationManagerDelegate {
let manager = CLLocationManager()
override func viewDidLoad() {
manager.delegate = self
View CoreGraphicsPlayground.swift
//: Playground - noun: a place where people can play
import UIKit
UIGraphicsBeginImageContext(CGSize(width: 10, height: 10))
let context = UIGraphicsGetCurrentContext()
let path = CGPathCreateMutable()
CGPathMoveToPoint(path, nil, 0, 0)
View .rb
class WebsiteValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
# I'm being pretty liberal with what is a valid URL as long as it has
# http:// or https:// at the front.
# Because it's only a matter of time before ICANN makes .💩 a gTLD
unless value =~ /(https|http):\/\/\S+\.\S+/
record.errors[attribute] << (options[:message] || "is not a website")
View gist:ef271af49dc6024da9b2
require 'test_helper'
class UserFlowsTest < ActionDispatch::IntegrationTest
test "login and browse site" do
# login via https
get "/login"
assert_response :success
post_via_redirect "/login", username: users(:david).username, password: users(:david).password