Skip to content

Instantly share code, notes, and snippets.

View Ambratolm's full-sized avatar
🌙

Ambratolm Ambratolm

🌙
View GitHub Profile
@Ambratolm
Ambratolm / check.js
Last active December 19, 2024 10:33
Simple JavaScript functions wrapper module for common checking of data types.
export const check = {
// Primitives
boolean(value) {
return typeof value === "boolean";
},
number(value) {
return typeof value === "number" && !isNaN(value);
},
biginit(value) {
@Ambratolm
Ambratolm / CinemachineLocker2D.cs
Created December 14, 2024 08:47
Cinemachine extension that locks the camera position along the X and Y axes.
using Sirenix.OdinInspector;
using Unity.Cinemachine;
using UnityEngine;
using static Unity.Cinemachine.CinemachineCore;
namespace Assets
{
/// <summary>
/// Cinemachine extension that locks the camera position along the X and Y axes.
/// </summary>
@Ambratolm
Ambratolm / Surface et périmètre d'un rectangle.c
Created June 25, 2017 11:30
Ecrire un algorithme qui calcule et affiche la surface et le périmètre d’un rectangle dont on lui donne la longueur et la largeur.
#include<stdio.h>
main()
{
printf("================================\n");
printf("Surface et périmètre d'un rectangle:\n");
printf("================================\n");
float l,L,S,P;
printf("Entrez la largeur : ");
scanf("%f",&l);
printf("Entrez la longueur : ");
@Ambratolm
Ambratolm / Calcul des salaires brut et net d’un employé.c
Created June 25, 2017 11:36
Ecrire un algorithme qui calcule (et affiche) les salaires mensuels brut et net d’un employé en sachant que : - le salaire brut est égal au nombre d’heures multiplié par le salaire horaire brut. - le salaire net est égal au salaire brut moins les charges. - le montant des charges est égal au salaire brut multiplié par le taux d’imposition. Vous …
#include<stdio.h>
main()
{
printf("Calcul des salaires brut et net d’un employé:\n");
float Sal_brt,Sal_net, Sal_hrs_brt,Nbr_hrs, charge;
float taux_impo=0.25;
printf("Entrez le nombre d'heures de travail par mois: ");
scanf("%f",&Nbr_hrs);
printf("Entrez le salaire horaire brut (en DH): ");
scanf("%f",&Sal_hrs_brt);
@Ambratolm
Ambratolm / ShadowCaster2DGenerator.cs
Last active February 20, 2023 16:07
Unity 2D Script : Attach this script to a CompositeCollider2D GameObject to quickly auto-generate ShadowCaster2D Childs based on the paths of the composite collider. Pretty handy for Tilemap case in which adding a ShadowCaster2D component just covers the map as whole, not every tile one by one as it is supposed to do. 🙂
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEditor;
using UnityEngine;
using UnityEngine.Rendering.Universal;
[RequireComponent(typeof(CompositeCollider2D))]
public class ShadowCaster2DGenerator : MonoBehaviour
{
@Ambratolm
Ambratolm / Classes Client et Compte.cs
Created June 25, 2017 22:12
Définir une classe Client avec les attributs suivants : CIN, Nom, Prénom, Tél. et Créer Une classe Compte caractérisée par son solde et un code qui est incrémenté lors de sa création ainsi que son propriétaire qui représente un client ....
class Client
{
// Attributs
private string cin, nom, prénom;
private int téléphone;
// Accesseurs
public int Téléphone
{
get { return téléphone; }
@Ambratolm
Ambratolm / user_aliases.cmd
Last active September 18, 2022 07:26
Useful Cmder user aliases. To put in the file at "%CMDER_ROOT%\config\user_aliases.cmd".
;= @echo off
;= rem Call DOSKEY and use this file as the macrofile
;= %SystemRoot%\system32\doskey /listsize=1000 /macrofile=%0%
;= rem In batch mode, jump to the end of the file
;= goto:eof
;= Add aliases below here
;= [Default]
e.=explorer .
gl=git log --oneline --all --graph --decorate $*
@Ambratolm
Ambratolm / copy-acl. ps1
Last active July 12, 2022 02:08
Copy security permissions (access control lists or ACL) from a file or folder to another.
# Open PowerShell with Admin rights
Get-Acl -Path 'C:\Some\Path' | Set-Acl -Path 'C:\Some\Other\Path'
@Ambratolm
Ambratolm / check-service.bat
Last active April 16, 2022 18:09
Check if a Windows service exists, Enable it, and Start it.
REM Check if service exists
sc query serviceName
REM Enable service to run automatically
sc config serviceName start= auto
REM Start service
net start serviceName
@Ambratolm
Ambratolm / comments.sublime-snippet
Last active March 17, 2022 01:10
Special comments snippets for Sublime Text.
<!--
# How to use:
• In Windows, Place the .sublime-sinppet files inside the "%AppData%\Sublime Text\Packages\User" folder.
• "%AppData%" refers commonly to "C:\Users\<WinUserName>\AppData\Roaming".
# Preview:
══════════════════════════════════════════════════════════════════════════════
■ Main-Title (file-name.js)
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
Description.