Skip to content

Instantly share code, notes, and snippets.

@princenyamadi
princenyamadi / fa-01.01-color-number-game.dart
Created November 17, 2024 00:13 — forked from bizz84/fa-01.01-color-number-game.dart
Color/Number Game with Flutter Implicit Animations
import 'dart:async';
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
runApp(const MyApp());
}
@princenyamadi
princenyamadi / rsa_pem.dart
Created October 15, 2023 19:38 — forked from proteye/rsa_pem.dart
How to encode/decode RSA private/public keys to PEM format in Dart with asn1lib and pointycastle
import 'dart:convert';
import 'dart:math';
import 'dart:typed_data';
import "package:pointycastle/export.dart";
import "package:asn1lib/asn1lib.dart";
List<int> decodePEM(String pem) {
var startsWith = [
"-----BEGIN PUBLIC KEY-----",
"-----BEGIN PRIVATE KEY-----",
class DownloadUtil {
static Future<String> downloadAndSaveFile(String url, String fileName) async {
final Directory directory = await getApplicationDocumentsDirectory();
final String filePath = '${directory.path}/$fileName.png';
final http.Response response = await http.get(Uri.parse(url));
final File file = File(filePath);
await file.writeAsBytes(response.bodyBytes);
return filePath;
}
class Solution {
int findKthLargest(List<int> nums, int k) {
// sort all values
nums.sort();
return nums[nums.length-k];
}
}
@princenyamadi
princenyamadi / auth.dart
Created August 12, 2022 05:23 — forked from nikhilmufc7/auth.dart
Firebase Flutter Platform Exception Codes and example
// Error Codes for SignUp
ERROR_OPERATION_NOT_ALLOWED` - Indicates that Anonymous accounts are not enabled.
ERROR_WEAK_PASSWORD - If the password is not strong enough.
ERROR_INVALID_EMAIL` - If the email address is malformed.
ERROR_EMAIL_ALREADY_IN_USE - If the email is already in use by a different account.
ERROR_INVALID_CREDENTIAL` - If the [email] address is malformed.
// sending password reset email
ERROR_INVALID_EMAIL` - If the [email] address is malformed.
@princenyamadi
princenyamadi / downloadFile.dart
Created June 9, 2022 15:56 — forked from ajmaln/downloadFile.dart
Download file with progress in Dart/Flutter using 'http' package
import 'dart:typed_data';
import 'dart:io';
import 'package:http/http.dart';
import 'package:path_provider/path_provider.dart';
downloadFile(String url, {String filename}) async {
var httpClient = http.Client();
var request = new http.Request('GET', Uri.parse(url));
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
GoRouter.setUrlPathStrategy(UrlPathStrategy.path);
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
Originall From: Posted 2015-05-29 http://ubwg.net/b/full-list-of-ffmpeg-flags-and-options
This is the complete list that’s outputted by ffmpeg when running ffmpeg -h full.
usage: ffmpeg [options] [[infile options] -i infile]… {[outfile options] outfile}…
Getting help:
-h — print basic options
-h long — print more options
-h full — print all options (including all format and codec specific options, very long)
@princenyamadi
princenyamadi / README.md
Created March 3, 2022 17:15 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@princenyamadi
princenyamadi / ccdl.command
Created February 11, 2022 00:58
Adobe Offline Package Generator v0.1.4 (macOS only)... Added M1 https://github.com/Drovosek01/adobe-packager if you want to install it another way.
#!/bin/bash
CYAN="$(tput bold; tput setaf 6)"
RESET="$(tput sgr0)"
clear
if command -v python3 > /dev/null 2>&1; then
if [ $(python3 -c "print('ye')") = "ye" ]; then
clear