Skip to content

Instantly share code, notes, and snippets.

View abbasmoosavi's full-sized avatar
😈

Abbas moosavi abbasmoosavi

😈
View GitHub Profile
@dehghani-mehdi
dehghani-mehdi / validate-national-code.js
Last active August 27, 2024 12:49
Validate Iranian national code in JavaScript - بررسی صحت کد ملی در جاوا اسکریپت
// C# version -> https://gist.github.com/dehghani-mehdi/2af3d913786d8b1b286f9c28cc75d5f4
var isValidNationalCode = function(code) {
if (code.length !== 10 || /(\d)(\1){9}/.test(code)) return false;
var sum = 0,
chars = code.split(''),
lastDigit,
remainder;
@patrickkempff
patrickkempff / KeychainStorage.js
Created June 18, 2018 16:32
redux-persist react-native-keychain
import { AsyncStorage } from 'react-native'
import { setGenericPassword, getGenericPassword, resetGenericPassword } from 'react-native-keychain'
export default {
async getAllKeys (callback) {
try {
const keys = await AsyncStorage.getAllKeys()
if (callback) {
callback(null, keys)
}