Skip to content

Instantly share code, notes, and snippets.

View dotrinh-DM's full-sized avatar
🤝
leadership

Do Trinh dotrinh-DM

🤝
leadership
View GitHub Profile
@dotrinh-DM
dotrinh-DM / gist:bb1e67e4fedb30a8e7ce324cd8f7c876
Created January 22, 2024 01:52
calculate duration of transaction Java
/*
* Created by dotrinh on 7/21/20 12:28 PM
*/
package jp.co.zoom.handyrecorder.tool;
/**
* calculate duration of transaction
*
* Usage:
@dotrinh-DM
dotrinh-DM / Apple_mobile_device_types.txt
Created January 4, 2023 08:23 — forked from adamawolf/Apple_mobile_device_types.txt
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
@dotrinh-DM
dotrinh-DM / hello_world.asm
Created December 23, 2022 10:13
Hello World Assembly Program on macOS
; ----------------------------------------------------------------------------------------
; Writes "Hello, World" to the console using only system calls. Runs on 64-bit macOS only.
; macOS:
; nasm -f macho64 hello_world.asm
; ld -macosx_version_min 10.7.0 -o hello_world hello_world.o
; ./hello_world
; ----------------------------------------------------------------------------------------
global start
@dotrinh-DM
dotrinh-DM / Tool.java
Created September 14, 2022 11:05
writing log to file
public static void log_to_internal_file(String data, Context context) {
try {
// /data/data/jp.co.xxx.G3ProRemote/files
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(context.openFileOutput("debug_log.txt", Context.MODE_APPEND));
String timeStamp = new SimpleDateFormat("yyyy:MM:dd_HH:mm:ss").format(Calendar.getInstance().getTime());
outputStreamWriter.append(timeStamp + " " + data + "\n");
outputStreamWriter.close();
} catch (IOException e) {
Log.e("Exception", "File write failed: " + e);
}
@dotrinh-DM
dotrinh-DM / IDE.txt
Last active July 22, 2022 12:13
Remove empty line in Jetbrains's IDE
Having to mix to get best result:
Replace: \n\n by \n
Replace: ^\s*^ by empty
@dotrinh-DM
dotrinh-DM / laravellocal.md
Created May 25, 2022 13:08 — forked from hootlex/laravellocal.md
Run laravel project locally

##Windows users:

cmder will be refered as console

##Mac Os, Ubuntu and windows users continue here:

  • Create a database locally named homestead utf8_general_ci
@dotrinh-DM
dotrinh-DM / ThirdMenuVC.m
Created November 5, 2021 11:43
prevent cell text is too long iOS
//prevent cell.valueLabel.text is too long
if(self.screenWidthShare <= 320){
if (rightMarkString.length >= 6) {
rightMarkString = [NSString stringWithFormat:@"%@...", [rightMarkString substringToIndex:3]];
}
} else {
if (rightMarkString.length >= 17) {
rightMarkString = [NSString stringWithFormat:@"%@...", [rightMarkString substringToIndex:12]];
}
}
@dotrinh-DM
dotrinh-DM / Animation.md
Created July 21, 2021 05:36 — forked from JeOam/Animation.md
iOS Core Animation: Advanced Techniques, Part 1: The Layer Beneath

Author: https://www.cyanhall.com/

1. The Layer Tree

Core Animation's original name is Layer Kit

Core Animation is a compositing engine; its job is to compose different pieces of visual content on the screen, and to do so as fast as possible. The content in question is divided into individual layers stored in a hierarchy known as the layer tree. This tree forms the underpinning for all of UIKit, and for everything that you see on the screen in an iOS application.

In UIView, tasks such as rendering, layout and animation are all managed by a Core Animation class called CALayer. The only major feature of UIView that isn’t handled by CALayer is user interaction.

There are four hierarchies, each performing a different role:

_AuthenticationServices_SwiftUI.framework
_AVKit_SwiftUI.framework
_HomeKit_SwiftUI.framework
_MapKit_SwiftUI.framework
_QuickLook_SwiftUI.framework
_SceneKit_SwiftUI.framework
_SpriteKit_SwiftUI.framework
_StoreKit_SwiftUI.framework
Accelerate.framework
Accessibility.framework
_AuthenticationServices_SwiftUI.framework
_AVKit_SwiftUI.framework
_MapKit_SwiftUI.framework
_QuickLook_SwiftUI.framework
_SceneKit_SwiftUI.framework
_SpriteKit_SwiftUI.framework
_StoreKit_SwiftUI.framework
Accelerate.framework
Accessibility.framework
Accounts.framework