#!/usr/bin/env ruby
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
load Gem.bin_path('bundler', 'bundle')
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let bear = Array("bear") | |
let bird = Array("bird") | |
let diff = bird.difference(from: bear) | |
let newBird = bear.applying(diff) | |
print(diff) | |
print(newBird) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func parsingDates() { | |
let date = Date.now | |
let format = Date.FormatStyle().year().day().month() | |
let formatted = date.formatted(format) // "Jun 7, 2021" | |
if let date = try? Date(formatted, strategy: format) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://developer.apple.com/videos/play/wwdc2022/110357 | |
import RegexBuilder | |
func ~=<T>(pattern :Regex<T> , value: String) -> Bool { | |
do { | |
return try pattern.firstMatch(in: value) != nil | |
} catch { | |
return false | |
} |
- authenticate_or_request_with_http_basic(realm = "Application", &login_procedure)
- authenticate_with_http_basic(&login_procedure)
- request_http_basic_authentication(realm = "Application")
render and redirect_to
To
form_for @obj, url: {action: 'create', type: @type}
NewerOlder