Skip to content

Instantly share code, notes, and snippets.

@houssenedao
houssenedao / main.dart
Last active May 29, 2019 10:15
Flutter default app
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
@houssenedao
houssenedao / main.dart
Last active May 29, 2019 10:34
Flutter padding all
...
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
@houssenedao
houssenedao / main.dart
Last active May 29, 2019 11:47
Flutter padding only
...
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
@houssenedao
houssenedao / BowValetDriver.php
Last active January 24, 2023 02:30
Laravel valet driver for Bow framework
<?php
class BowValetDriver extends ValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
@houssenedao
houssenedao / cinetpay.service.ts
Last active November 16, 2021 09:16
Nestjs - CinetPayService
import { Injectable, InternalServerErrorException, Logger } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { HttpRequestService } from './http-request.service';
interface ICinetpayConfig {
apikey: string;
siteId: string;
lang?: string;
currency?: string;
channels?: PaymentChannel;
@houssenedao
houssenedao / regex
Created November 16, 2021 09:18
Cote d'ivoire mobile phone number regex validation
/^\+225\d(?:0|1|5|7)\d{8}$/
@houssenedao
houssenedao / key-match.ts
Created January 24, 2022 12:57
Retrieve merchant name
function findMerchant(description: string): string | undefined {
const Merchants = {
Facebook: "fcbk,facebook,fb,facebk",
Netflix: "netflix,nl",
Tinder: "tinder,gotinder",
Amazon: "amzn,amazon",
Glovo: "glovo"
};
const merchantsKeys = Object.keys(Merchants);
@houssenedao
houssenedao / circuit-breaker.php
Last active February 13, 2024 15:43
Circuit breaker php
<?php
// The circuit breaker class
class CircuitBreaker
{
// The failure threshold
private $failureThreshold;
// The failure count
private $failureCount = 0;
@houssenedao
houssenedao / double-entry-accounting.ts
Last active February 13, 2024 15:44
double-entry accounting
class Account {
// The name of the account
name: string;
// The type of the account (e.g. asset, liability, etc.)
type: string;
// The balance of the account
balance: number;
@houssenedao
houssenedao / partialMatch.js
Created February 4, 2024 19:28 — forked from stewartmcgown/partialMatch.js
Partial Match properties of Object Array (ES6)
/**
* Are all the values on p present on o
* @param {Object} o object to search
* @param {Object} p object of search values
* @param {Boolean} [c] are loose equality matches ok?
* @return {Boolean} whether there are partial matches
*/
const partialMatch = (o, p, c) =>
Object.keys(p).every(k =>
p[k] && o[k]