Skip to content

Instantly share code, notes, and snippets.

@manhduydl
manhduydl / show_alert_dialog.dart
Created May 5, 2025 14:24 — forked from bizz84/show_alert_dialog.dart
Helper function for showing an adaptive alert dialog (Material, Cupertino)
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
/// Helper function for showing an adaptive alert dialog
/// Returns:
/// - true if the default action was selected
/// - false if the cancel action was selected
/// - null if the dialog was dismissed
Future<bool?> showAlertDialog({
required BuildContext context,
@manhduydl
manhduydl / is_prime.py
Created January 10, 2025 07:50
Check prime number
from math import *
def is_prime(n):
if n < 2: return False
for i in range(2, isqrt(n)+1):
if n%i == 0: return False
return True
@manhduydl
manhduydl / linked_list.py
Last active January 10, 2025 07:51
Print linked list for debug
def printll(self):
print("Head", end=" ")
node = self.__head.next
while node is not None:
print(f"-> {node.value}", end=" ")
node = node.next
print()