Skip to content

Instantly share code, notes, and snippets.

View dehghani-mehdi's full-sized avatar
💭
Waiting ...

Mehdi Dehghani dehghani-mehdi

💭
Waiting ...
  • Rightek
  • That's what she said
View GitHub Profile
[buildPlans.iosevka-custom]
family = "Iosevka Custom"
spacing = "term"
serifs = "sans"
no-cv-ss = true
[buildPlans.iosevka-custom.variants]
inherits = "ss10"
[buildPlans.iosevka-custom.variants.design]
// based on js version -> https://gist.github.com/dehghani-mehdi/df7f216d8031abad8c911b8117b7000e
public bool IsValidNationalCode(string value)
{
// extract only numbers form the value
value = new string(value?.Where(char.IsDigit).ToArray());
if (value.Length != 10 || Regex.IsMatch(value, @"(\d)(\1){9}")) return false;
var sum = 0;
var chars = value.ToCharArray();
// ref: https://stackoverflow.com/a/538238/3367974
public class Foo : IDisposable
{
protected void Dispose(Boolean disposing)
{
// free unmanaged resources
if (disposing)
{
// free managed resources