Skip to content

Instantly share code, notes, and snippets.

View Goridev's full-sized avatar

Igor François Goridev

View GitHub Profile
@Goridev
Goridev / ask_from_prompt.s
Created November 21, 2023 22:10
Assembleur MacOS ARM64
.global _start
.p2align 2
_start:
bl _printprompt
bl _read
bl _printbuffer
bl _terminate
_printprompt:
@Goridev
Goridev / SizedContent.kt
Last active September 16, 2023 15:32
Gestion des différentes tailles d'écran sur Android avec Compose - Managing different screen sizes on Android with Compose
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
/**
@Goridev
Goridev / nav.kt
Created March 22, 2023 20:28
Passer un Bundle via la navigation - Jetpack compose
// Navigation de A vers B on transfére User
// Dans le composable A
navController.currentBackStackEntry.savedStateHandle.set("user", user)
// Dans le composable B
navController.previousBackStackEntry.savedStateHandle.get<User>("user")
/*
* Pas faire popUpTo(0) sinon le savedStateHandle se vide
*/
@Goridev
Goridev / HomeView.swift
Created August 26, 2022 07:09
Accessibility - How to target an other element programmatically - SwiftUI - But a bit UIKIT...
/// Somewhere inside HomeView
UIAccessibility.post(notification: .screenChanged, argument: contentView)
@Goridev
Goridev / git.md
Last active October 26, 2023 13:01
Github utility

Config wrote in file ~/.gitconfig

git config user.name "Your Name"
git config user.email "youremail@yourdomain.com"

# Ceci est le fichier de configuration personnel de Git.
[alias]
	lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)' --all
	lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n''          %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
	lg = lg1
@Goridev
Goridev / Utils.swift
Last active June 30, 2022 18:29
Utility iOS - Swift
// .transition(.move(edge: .bottom))
// .animation(.linear)
/// Put this function inside an UIScreen extension
extension UIScreen {
enum Layout: CaseIterable {
case rows
case columns
}
static func getSizeOf(for type: Layout, nb: CGFloat = 1, space: CGFloat = 0 ) -> CGFloat {
let size = type == .rows ? self.main.bounds.size.height : self.main.bounds.size.width
@Goridev
Goridev / devired.sh
Created June 21, 2022 08:07
Clear DerivedData
rm -Rf ~/Library/Developer/Xcode/DerivedData/
@Goridev
Goridev / Bundle+.swift
Last active June 16, 2022 21:46
Get Bundle info from specific pod lib in different way
public extension Bundle {
// 1
static var apiKey: String? = {
return Bundle.for(for: SpecificPodLib.self).infoDictionnary?[.apiKey] as? String
}()
// 2
static var apiKey: String? {
return Bundle.for(for: SpecificPodLib.self).infoDictionnary?[.apiKey] as? String
}
// 3
@Goridev
Goridev / ListenerImpl.kt
Last active May 10, 2022 21:48
Setup a listener throught app -> Use a framework with a listener and implement him on another module as an dependance injection with Dagger Hilt
class ListenerImpl @Inject constructor(
val otherModule: OtherModule
) : Listener {
override onClick(params: WhateverClass.Params){
super.onClick(params)
otherModule.someCall(params)
}
}
@Goridev
Goridev / ReadByte.c
Last active March 22, 2022 09:46
Read byte by byte
#include "ReadByte.h"
int main(int argc, const char * argv[]) {
reader read;
read.file_ptr = fopen(argv[1], "rb");
if(read.file_ptr == NULL)
{
fprintf(stderr, "cannot open input file\n");
return 1;
}