Skip to content

Instantly share code, notes, and snippets.

View Alii-isk's full-sized avatar

alii-Isk Alii-isk

  • Morocco
View GitHub Profile
@Alii-isk
Alii-isk / js-pagination.js
Created September 23, 2022 03:54
A simple vanilla javascript pagination function NO DOM
export const paginate = ({lastPage,currentPage}) => {
const _links = Array.from({ length: lastPage}, (_, i) => i + 1);
return _links.reduce((acc, link) => {
if (
link === 1 ||
link === _links.length ||
(link > currentPage - 2 && link < currentPage + 2)
) {
acc.push(link);
} else if (
@Alii-isk
Alii-isk / MainActivity.kt
Created January 29, 2023 19:52
flutter LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
/* ----------------------------------------------------------------------- */
/* ENABLE CUTOUT MODE FOR ANDROID 9.0 AND ABOVE DEVICES */
/* to avoid notch cutout and black bars on the sides issue in flutter */
/* ----------------------------------------------------------------------- */
import android.os.Build
import android.view.WindowManager
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity(){
@Alii-isk
Alii-isk / cryptojs_aes_encryption_helper.dart
Created February 1, 2023 23:51 — forked from suehok/cryptojs_aes_encryption_helper.dart
Cryptojs aes password encryption helper for dart
import 'dart:convert';
import 'dart:math';
import 'dart:typed_data';
import 'package:crypto/crypto.dart';
import 'package:tuple/tuple.dart';
import 'package:encrypt/encrypt.dart' as encrypt;
String encryptAESCryptoJS(String plainText, String passphrase) {
try {
final salt = genRandomWithNonZero(8);