Skip to content

Instantly share code, notes, and snippets.

View megaacheyounes's full-sized avatar
turning coffee into code

Megaache Younes megaacheyounes

turning coffee into code
View GitHub Profile
@megaacheyounes
megaacheyounes / general.scss
Last active November 15, 2019 16:08
general css utility classes
.w-2 {
width: 2px !important;
}
.h-2 {
height: 2px !important;
}
.mar-2 {
margin: 2px !important;
@megaacheyounes
megaacheyounes / huawei_devices_detection_demo.html
Last active April 18, 2024 09:53
Simple example showing the detection of Huawei devices using the UserAgent
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Huawei device detection using user agent</title>
</head>
<body>
<h1 id="h1">Loading...</h1>
@megaacheyounes
megaacheyounes / AdBannerCompose.kt
Created September 28, 2022 10:15
Huawie banner ad using jetpack compose sample
@Composable
fun AdBannerCompose(
modifier: Modifier = Modifier,
adId: String = "testw6vs28auh3",
) {
AndroidView(
modifier = modifier.fillMaxWidth(),
factory = { context ->
BannerView(this).apply {
adId = adId
@megaacheyounes
megaacheyounes / AddCookiesInterceptor.java
Created January 4, 2023 16:22 — forked from tsuharesu/AddCookiesInterceptor.java
Handle Cookies easily with Retrofit/OkHttp
/**
* This interceptor put all the Cookies in Preferences in the Request.
* Your implementation on how to get the Preferences MAY VARY.
* <p>
* Created by tsuharesu on 4/1/15.
*/
public class AddCookiesInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
@megaacheyounes
megaacheyounes / tips.md
Last active May 12, 2023 09:07
HarmonyOS development tips (more tips are being added)

HarmonyOS development tips

HarmonyOS development tips

How to connect HarmonyOS device for debugging (wirelessly)

  1. Create hotspot from PC (or from your phone and connect to the hotspot from PC)
  2. Connect to hotspot from the watch
  3. On the watch, go to Settings -> developer options -> Wifi debugging: you should see Ip address and port (if not, then disable and re-enable wifi debugging option)
  4. On PC, run command : hdc tconn :
@megaacheyounes
megaacheyounes / starship.toml
Created April 11, 2023 11:19
terminal style for starship, save to ~/.config/starship.toml, download starship => https://starship.rs
#Younes Megaache starship terminal config
#April 11th, 2023
format = "$directory$git_branch$package$time$cmd_duration$character"
[line_break]
disabled = true
[character]
success_symbol = "[➜](bold green) "
error_symbol = "[✗](bold red) "
@megaacheyounes
megaacheyounes / settings.gradle
Created September 18, 2023 05:23
optimized settings.gradle example
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
google() {
content {
//check google repo only for google dependencies
includeGroupByRegex "com\\.google.*"
includeGroupByRegex "com\\.android.*"
includeGroupByRegex "androidx.*"
}
@megaacheyounes
megaacheyounes / TimberTree.kt
Created October 31, 2023 12:24
Tree for Timber Android logger with persistent storage to txt file
package com.megaache.myapp.util
import android.os.Environment
import android.util.Log
import com.megaache.myapp.BuildConfig
import com.megaache.myapp.FmtApp
import timber.log.Timber
import timber.log.Timber.DebugTree
import java.io.File
import java.io.FileInputStream
@megaacheyounes
megaacheyounes / build.gradle
Created October 31, 2023 12:31
sample build.gradle script with dynamic APK naming and versioning
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
}
android {
compileSdk 34