Skip to content

Instantly share code, notes, and snippets.

View chu-yik's full-sized avatar
🇨🇦

Yik Chu chu-yik

🇨🇦
View GitHub Profile
@chu-yik
chu-yik / go_modules.md
Last active November 12, 2021 01:11
Go modules takeaways
@chu-yik
chu-yik / shell.md
Last active November 7, 2021 03:34
Shell script cheatsheet

-z

-z to test if string is null (zero length)

if [ -z "$AWS_ACCOUNT_ID" ]; then
    echo "AWS_ACCOUNT_ID environment variable is not set."
    exit 1
fi
@chu-yik
chu-yik / fix_whitespace_in_patch.md
Created December 21, 2018 14:43
How to fix whitespace in .patch file

Fix whitespace in .patch files

  1. go to package.json and remove postinstall from scripts
  • i.e. remove this line:
"postinstall": "patch-package && rm -f ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json",
  • this is to stop broken patches from being auto applied after yarn
  • DO NOT commit this change
@chu-yik
chu-yik / ios-cell-registration-swift.md
Last active March 1, 2020 04:02 — forked from andreaantonioni/ios-cell-registration-swift.md
iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

A common task when developing iOS apps is to register custom cell subclasses for both UITableView and UICollectionView. Well, that is if you don’t use Storyboards, of course.

Both UITableView and UICollectionView offer a similar API to register custom cell classes:

for UITableView

public func register(_ cellClass: AnyClass?, forCellReuseIdentifier identifier: String)
public func register(_ nib: UINib?, forCellReuseIdentifier identifier: String)