Skip to content

Instantly share code, notes, and snippets.

View bienvenuelisis's full-sized avatar
🎯
Focusing

Kokou AGBAVON bienvenuelisis

🎯
Focusing
View GitHub Profile
@bienvenuelisis
bienvenuelisis / singleton_with_parameters.dart
Created October 23, 2023 12:18
Singleton with parameters in Dart.
class HttpRequest {
factory HttpRequest({required String baseUrl}) {
_instance.baseUrl = baseUrl;
return _instance;
}
HttpRequest._internal();
late String baseUrl;
@bienvenuelisis
bienvenuelisis / variousCountryListFormats.js
Created May 16, 2022 10:28 — forked from incredimike/variousCountryListFormats.js
List of Countries in various Javascript data structures: Alphabetical country lists & Country data objects.
// Lists of countries with ISO 3166 codes, presented in various formats.
// Last Updated: July 30, 2020
// If you're using PHP, I suggest checking out:
// https://github.com/thephpleague/iso3166
// or Laravel: https://github.com/squirephp/squire
//
// JS developers can check out:
// https://www.npmjs.com/package/iso3166-2-db
//
@bienvenuelisis
bienvenuelisis / MainActivity.java
Created April 22, 2022 08:22 — forked from jaekook/MainActivity.java
Android: How to collect the response of a USSD request (Including multi-session requests)
//Get the instance of TelephonyManager
final TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
try {
if (tm != null) {
Class telephonyManagerClass = Class.forName(tm.getClass().getName());
if (telephonyManagerClass != null) {
Method getITelephony = telephonyManagerClass.getDeclaredMethod("getITelephony");
class DoubleTextInputFormatter extends TextInputFormatter {
final bool positive;
final double maxValue;
DoubleTextInputFormatter({
this.positive = false,
this.maxValue = double.maxFinite,
});
String? validateIntValue(
String value,
String errorMsg, {
bool positive = false,
int maxValue = 9223372036854775807,
}) {
if (value.isEmpty) {
return errorMsg;
} else {
try {
@bienvenuelisis
bienvenuelisis / posts_api.json
Last active March 28, 2022 01:14
Jekyll Posts API Models, with Liquid Filters.
---
layout: null
permalink: /api/
#So your API will be accessible at <mydomain>/api
# newline_to_br - replace each newline (\n) with html break
# replace - replace each occurrence e.g. {{ 'foofoo' | replace:'foo','bar' }} #=> 'barbar'
# prepend - prepend a string e.g. {{ 'bar' | prepend:'foo' }} #=> 'foobar'
# append - append a string e.g. {{ 'foo' | append:'bar' }} #=> 'foobar'
---
@bienvenuelisis
bienvenuelisis / database.php
Created December 14, 2021 16:11
Slim PHP Framework : DB Connection Sample
<?php
namespace Database {
class Db
{
private $servername = "localhost";
private $username = "root";
private $password = "";
private $database = "";
public $conn = "";