Skip to content

Instantly share code, notes, and snippets.

View Akhu's full-sized avatar
🏠
Working from home

Anthony Da Cruz Akhu

🏠
Working from home
View GitHub Profile
@Akhu
Akhu / TranslateSVGPathToSwiftUIPath.js
Created August 6, 2022 17:10
Quick tool to convert SVG Path to SwiftUI Path, I did this quickly, it is missing many SVG path identifier but you will figure out how to make it work yourself it's pretty easy.
/**
* Creating SwiftUI Path from SVG path data
*/
const regex = /([MmLlSsQqLlHhVvCcSsQqTtAaZz]){1} ((-?[0-9]*\.?\d+) ){2,6}|Z/mg;
//Replace content of svgPath by your SVG Path data
const svgPath = `M 13.0286 28 C 22.123 12 26.6701 4.3722 32.6067 1.7291 C 37.7849 -0.5764 43.698 -0.5764 48.8762 1.7291 C 54.8128 4.3722 59.3599 12.2481 68.4543 28 C 77.5486 43.7519 82.0958 51.6278 81.4165 58.0906 C 80.824 63.7277 77.8674 68.8487 73.2818 72.1803 C 68.0245 76 58.9301 76 40.7414 76 C 22.5528 76 13.4584 76 8.2011 72.1803 C 3.6155 68.8487 0.6589 63.7277 0.0664 58.0906 C -0.6129 51.6278 3.9343 43.7519 13.0286 28 Z`;
let regexDetectionResult;
@Akhu
Akhu / GitUnity-Readme.md
Last active April 1, 2022 16:52
Créer un répertoire git propre pour Unity

Instruction pour un repertoire Git propre pour Unity

Basé en partie sur cet article : https://thoughtbot.com/blog/how-to-git-with-unity

Remote - Site de Github

  1. Créer un répertoire Git sur Github pour votre groupe

En local - sur votre ordinateur (1 seul développeur à besoin de le faire, une seule fois)

Optionnel si vous avez eu un problème

  • Retirez tous les dossiers .git dans le dossier de projet (cela permettra de retirer l'historique qui contient les compilations à ne pas envoyer) -> Dans un terminal $ rm -fr .git sur Mac / Linux
@Akhu
Akhu / Svelte-Dockerfile
Last active February 8, 2022 10:37
Svelte Deployment via Docker with PGSSQL
# Svelte DockerFile
FROM node:14.17.6-alpine
#To fix the node-gyp rebuild error
RUN apk add --no-cache --virtual .gyp python make g++
# install dependencies
WORKDIR /app
COPY package.json package-lock.json ./
@Akhu
Akhu / Future.kt
Last active December 24, 2021 10:51
🎄 New Year Code 2022
/**
* You can edit, run, and share this code.
* play.kotlinlang.org
*/
import kotlin.random.Random
class Celebration(val year: Int, val stillWithCovid: Boolean = false) {
override fun toString(): String {
return "Bonnes fêtes & bonne année ${this.year} ! 🎉 " + (if (stillWithCovid) "On va encore avoir pas mal de covid 🦠" else "⛑ Ca va aller mieux !")
}
@Akhu
Akhu / network_call_sample.dart
Last active November 19, 2021 15:24
Simple Http Query with Dart and Unsplash
Future<List<UnsplashImage>> getRecentPhotos({
int perPage = 10,
int pageNumber = 0,
String? searchQuery
}) async {
var parameters = {
"client_id": "$apiKey",
"per_page": "$perPage",
"page": "$pageNumber"
//
// BindingBlurSampleView.swift
// InstaFilter
// Credit to Paul Hudson
// Created by Anthony Da cruz on 05/10/2021.
//
import SwiftUI
struct BindingBlurSampleView: View {
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]> <html class="no-js"> <!--<![endif]-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
@Akhu
Akhu / MapActivity.kt
Created July 26, 2021 09:00
Sealed Class for UI State sample Kotlin + Android
package com.pickle.theendormap.map
import android.Manifest
import android.content.Intent
import android.content.pm.PackageManager
import android.content.res.Resources
import android.net.Uri
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
@Akhu
Akhu / coroutines.md
Created December 21, 2020 07:57
Understanding Kotlin Coroutines

KotlinExplorer

Playground and sample for mastering Kotlin

Concurrent

Coroutines are concurrent. And can run in parallel.

class MainActivity : AppCompatActivity() {
private lateinit var navController: NavController
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
/**
* We assign the navController from the XML interface.