Skip to content

Instantly share code, notes, and snippets.

@ibrahimlawal
ibrahimlawal / PaystackFees.php
Last active April 6, 2020 00:57
A php class to add paystack's local charge to a transaction total. Totally flops if the user pays with a foreign card.
<?php
class PaystackFees
{
const DEFAULT_PERCENTAGE = 0.015;
const DEFAULT_ADDITIONAL_CHARGE = 10000;
const DEFAULT_THRESHOLD = 250000;
const DEFAULT_CAP = 200000;
public static $default_percentage = PaystackFees::DEFAULT_PERCENTAGE;
@ibrahimlawal
ibrahimlawal / README.md
Last active November 22, 2019 12:19
My PHP libraries Git hooks

PRE-REQUISITES

  • php in your path
  • git
  • your php projects should have phpunit installed

INSTALL

  • download all files, rename them removing the .sh extension.
  • chmod +x each of them
  • copy git-mrm and git-ddev to a folder in your executable path e.g. /usr/local/bin
@ibrahimlawal
ibrahimlawal / PaystackFee.js
Last active March 23, 2019 07:21
Add Paystack fees in Javascript
function PaystackFee() {
this.DEFAULT_PERCENTAGE = 0.015;
this.DEFAULT_ADDITIONAL_CHARGE = 10000;
this.DEFAULT_THRESHOLD = 250000;
this.DEFAULT_CAP = 200000;
this.percentage = this.DEFAULT_PERCENTAGE;
this.additional_charge = this.DEFAULT_ADDITIONAL_CHARGE;
this.threshold = this.DEFAULT_THRESHOLD;
this.cap = this.DEFAULT_CAP;
@Kendysond
Kendysond / clean.php
Last active October 31, 2018 23:58
Clean any Nigerian Number format to be ready for sending SMS
function clean_number($phone_number){
$phone_number = preg_replace('/^0/','234',$phone_number);
$phone_number = preg_replace('/^\+/','',$phone_number);
return $phone_number;
}
// This should convert a number like 09023293092 or +2349023293092 to 2349023293092
@sandfox
sandfox / README.md
Last active September 19, 2018 03:39
Simple example upstart config for nodejs

This example assumes your running a recent Ubuntu with upstart installed and you have install n from npm.

To see an example use of this ina a wider context, look at this gist for deploying node.js + nginx

Adapt as required.

  1. Put the node.conf in /etc/init/
  2. Create a folder for individual site configs to live in /etc/node
  3. Put the node-test.conf inside /etc/node
  4. Create the folder for the logs /var/logs/node
@scottsd
scottsd / world.sql
Created March 8, 2013 17:14
world.sql
CREATE TABLE City (
ID BIGSERIAL,
Name varchar(35) NOT NULL DEFAULT '',
CountryCode varchar(3) NOT NULL DEFAULT '',
District varchar(20) NOT NULL DEFAULT '',
Population int NOT NULL DEFAULT '0'
)
;