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 | |
} |
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
I am developing for iOS and RoR. For date time issue, I feel lucky, since both works with ISO 8601. | |
By default, Rails 4 returns ISO 8601 format as json output. | |
On iOS, you should have date format as @"yyyy-MM-dd'T'HH:mm:ssZZZ" | |
See http://developer.github.com/v3/ (search "ISO") |
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
Customizing a model object's JSON representation, first of all, is a business of ActiveRecord::Serialization. You will look at ActiveModel::Serializers::JSON class | |
https://github.com/rails/rails/blob/master/activemodel/lib/active_model/serializers/json.rb | |
and then will come back to ActiveModel::Serialization class | |
https://github.com/rails/rails/blob/master/activemodel/lib/active_model/serialization.rb | |
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
Do you know, you can access your own rails website on /rails/info/routes , under development environment? | |
The working house is shown below. | |
https://github.com/rails/rails/blob/master/railties/lib/rails/info_controller.rb | |
In turn, ActionDispatch::Routing::RoutesInspector is the real hero. Linked below. | |
https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/routing/inspector.rb |
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
UIStory needs a Procedure to guide it, and story listens to Procedure's events of proceed and complete . | |
It is UIStory to expose proceedNext method for client to call. While UI will have "next" button to proceed the procedure, too. | |
UIStory has a JXUIVCFactory_ProcedureStep . | |
VCFactory will createVC, setObject:intoVC, and getObject:fromVC, according to step. | |
Since the kinds of steps are currently limited, the VC types to be used are limited too, therefore manually manageable. | |
JXModel_ProcedureStep_ObjectPart_Attribute --- JXUITVDSD_NSArray_Selection (or JXUITVDSD_NSArray_Selection__allowsAddSimpleTextOptions) |
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
## Filtering | |
NSPredicate | |
## Ordering/Sorting | |
NSSortDescriptor |
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
Controller 和 Filter 互联方案 | |
以ControllerContext为中介,合理利用ViewData。 | |
http://msdn.microsoft.com/en-us/library/system.web.mvc.controllercontext(v=vs.108).aspx | |
自定义Model类: | |
UserIntention |
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
class_addIvar, in Objective-C runtime, is useless, because it does not support to add ivar in an EXISTING class. | |
https://developer.apple.com/library/ios/documentation/Cocoa/Reference/ObjCRuntimeRef/Reference/reference.html#//apple_ref/c/func/class_addIvar | |
You can use the concept of idInfo (see id-ego-superego), to add run-time generated objects' property. | |
NewerOlder