Skip to content

Instantly share code, notes, and snippets.

View phucledien's full-sized avatar
🇻🇳
Xin chào

Le Dien Phuc phucledien

🇻🇳
Xin chào
View GitHub Profile
@jasdev
jasdev / ScrimLoader.swift
Last active April 19, 2024 03:47
Rough sketch of Arc’s scrim loading view.
import SwiftUI
/**
### Exercises for the viewer
- Phase interrupt handling.
- Use Swift concurrency.
- Color scheme awareness.
- Rework animations to be more spring-like à la what shipped in `0.90.0`.
@bashbunni
bashbunni / .zshrc
Created October 27, 2022 21:41
CLI Pomodoro for Mac
# I'll be doing another one for Linux, but this one will give you
# a pop up notification and sound alert (using the built-in sounds for macOS)
# Requires https://github.com/caarlos0/timer to be installed
# Mac setup for pomo
alias work="timer 60m && terminal-notifier -message 'Pomodoro'\
-title 'Work Timer is up! Take a Break 😊'\
-appIcon '~/Pictures/pumpkin.png'\
-sound Crystal"
@trungdq88
trungdq88 / paddle-revenue.js
Last active April 6, 2023 14:07
A scriptable's script to get Paddle revenue from multiple accounts using puppeteer.
/*
RUN THE SCRIPT BY YOURSELF:
- Run `node paddle-revenue.js` on your server and let it run 24/7.
- Access the API at http://your_server_ip:8175/ (JSON)
HOSTED VERSION:
If you don't want to run the script by your own, you can use the
hosted version. The price is $5 per month per Paddle account.
Here is how:
@fvictorio
fvictorio / hardhat-mocking.md
Created July 20, 2021 11:52
Hardhat: stubs and mocks

If you want to test a contract that depends on other contract, but you don't own the latter contract (or you do but you want to test the first contract in isolation), you need to either stub or mock that dependency.

If you are not sure about the difference between a stub and a mock, check this StackOverflow question

Stubbing

If the contract you are testing receives its dependency in some way, you can write a stub contract and use that in your tests. It would be something like this:

contract ContractToTest {
// Based on Kickstarter-Prelude version
// https://github.com/kickstarter/Kickstarter-Prelude/blob/master/Prelude-UIKit/UIImage.swift
extension UIImage {
/**
- parameter color: A color.
- returns: A 1x1 UIImage of a solid color.
*/
static func pixel(ofColor color: UIColor) -> UIImage {
let lightModeImage = UIImage.generatePixel(ofColor: color, userInterfaceStyle: .light)
@tuhuynh27
tuhuynh27 / react-rendering.md
Last active October 24, 2023 13:24
A (Mostly) Complete Guide to React Rendering Behavior

Translated from https://blog.isquaredsoftware.com/2020/05/blogged-answers-a-mostly-complete-guide-to-react-rendering-behavior/, author: Mark Erikson (from Redux team)

A (Mostly) Complete Guide to React Rendering Behavior

Bài viết cung cấp chi tiết về cách mà React render hoạt động, và việc sử dụng Context và Redux ảnh hưởng thế nào tới quá trình render của React.

"Render" là gì

Rendering is the process of React asking your components to describe what they want their section of the UI to look like, now, based on the current combination of props and state.

@funmia
funmia / ios-interview-resources.md
Last active October 26, 2024 08:31
General iOS, CS questions and interview prep resources.
// Original article here: https://www.fivestars.blog/code/redacted-custom-effects.html
import SwiftUI
// MARK: Step 1: Create RedactionReason
public enum RedactionReason {
case placeholder
case confidential
struct ContentView: View {
var body: some View {
VStack{
Label("Hello Label", systemImage: "sun.min")
.font(.system(.title, design: .rounded))
Label("Title only label", systemImage: "sun.min")
.font(.system(.title, design: .rounded))
@DreamingInBinary
DreamingInBinary / Best in Class iOS Checklist
Last active October 14, 2024 16:16
This is a public checklist updated every year after the latest version of iOS and iPadOS are shipped. It's a boiled down version of a "Best in Class" app checklist created by Jordan Morgan.
# A Best in Class Checklist
A boiled down checklist adapted from this [post](https://www.swiftjectivec.com/a-best-in-class-app/), created by @jordanmorgan10.
> To use this, create a Github Issue in your own repo, and simply copy and paste this text.
## iOS Core Technology
_Things any iOS app can benefit from_
- [ ] iCloud Sync
- [ ] Focus Filter Support