Skip to content

Instantly share code, notes, and snippets.

class Foo {
var name: String? // instance property
/**
You define type properties with the static keyword.
For computed type properties for class types,
you can use the class keyword instead to allow subclasses to override the superclassโ€™s implementation.
The example below shows the syntax for stored and computed type properties
*/
@5SMNOONMS5
5SMNOONMS5 / alias.pl
Last active March 18, 2024 15:15
personal alias for mac OS
### Normal
alias cl_ipconfig='ifconfig | grep inet'
### iOS
alias cl_show_simulators='xcrun simctl list'
alias cl_open_xcode_matadata='open -a finder ~/Library/Developer/Xcode'
alias cl_open_provisioning_profiles='open -a finder ~/Library/MobileDevice/Provisioning\ Profiles/'
@5SMNOONMS5
5SMNOONMS5 / ๅฐ็ฃ่บซๅˆ†่ญ‰่ช่ญ‰.swift
Last active February 13, 2023 02:42
ๅฐ็ฃ่บซๅˆ†่ญ‰่ช่ญ‰ swift 5
//A ๅฐๅŒ—ๅธ‚ J ๆ–ฐ็ซน็ธฃ
//B ๅฐไธญๅธ‚ K ่‹—ๆ —็ธฃ T ๅฑๆฑ็ธฃ
//C ๅŸบ้š†ๅธ‚ U ่Šฑ่“ฎ็ธฃ
//D ๅฐๅ—ๅธ‚ M ๅ—ๆŠ•็ธฃ V ๅฐๆฑ็ธฃ
//E ้ซ˜้›„ๅธ‚ N ๅฝฐๅŒ–็ธฃ W ้‡‘้–€็ธฃ
//F ๅฐๅŒ—็ธฃ O ๆ–ฐ็ซนๅธ‚ X ๆพŽๆน–็ธฃ
//G ๅฎœ่˜ญ็ธฃ P ้›ฒๆž—็ธฃ
//H ๆกƒๅœ’็ธฃ Q ๅ˜‰็พฉ็ธฃ Z ้€ฃๆฑŸ็ธฃ
//I ๅ˜‰็พฉๅธ‚
@5SMNOONMS5
5SMNOONMS5 / Triangle.swift
Last active January 23, 2017 15:52
Print right-angled-triangle or isosceles-triangle
// mode: 0 ๆ˜ฏ ็›ด่ง’ไธ‰่ง’ๅฝข, 1 ๆ˜ฏ ็ญ‰่…ฐไธ‰่ง’ๅฝข
// size: ้‚Š้•ท
func printer(mode: Int, size: Int) {
// Print a right angled triangle
func rightAngledTriangle() {
var i = 1
while i <= size {
var string = ""
# Thanks to here https://stackoverflow.com/questions/13861658/is-it-possible-to-search-though-all-xcodes-logs
EXT=".xcactivitylog"
for LOG in *.xcactivitylog; do
NAME=`basename $LOG $EXT`
gunzip -c -S $EXT "${NAME}${EXT}" > "${NAME}.log"
done
@5SMNOONMS5
5SMNOONMS5 / bitwise.php
Last active August 13, 2018 02:58
้€š้Ž bitwise ๆ–นๅผไพ†ๅˆคๆ–ทๆฌŠ้™
<?php
$premissionA = 1; // 1
$premissionB = 1 << 1; // 2
$premissionC = 1 << 2; // 4
$premissionD = 1 << 3; // 8
$premissionE = 1 << 4; // 16
$premissionF = 1 << 5; // 32
$premissionG = 1 << 6; // 64
$premissionH = 1 << 7; // 128
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
@5SMNOONMS5
5SMNOONMS5 / CCCollectionView.swift
Last active November 5, 2019 03:55
Generic types collection view with default selection [ Copy and paste it into your playground ]
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
// ******************************************
//
// MARK: - Config injection
//
// ******************************************
@5SMNOONMS5
5SMNOONMS5 / CLSTableView.swift
Last active December 11, 2019 09:44
GenericType TableView, Copy and paste into your playground files
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
/// CLSTableViewConfig for extend, add more tableview properties.
struct CLSTableViewConfig {
var heightForRow: CGFloat?
}
protocol CLSPickerViewProtocol {
var title: String { get }
var id: Int { get }
}
final class CLSPickerView<T: LLPickerViewProtocol>: UIPickerView, UIPickerViewDelegate, UIPickerViewDataSource {
var selectHandler: ((T) -> Void)?
var contents: [T] = [] {