Skip to content

Instantly share code, notes, and snippets.

Ibrahim Lawal ibrahimlawal

Block or report user

Report or block ibrahimlawal

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ibrahimlawal
ibrahimlawal / validateCardNumber.php
Last active Sep 10, 2019
Validate card numbers using Regex and a Luhn Check
View validateCardNumber.php
<?php
class Operations {
const PATTERN_AMERICAN_EXPRESS = "/^3[47][0-9]{13}$/";
const PATTERN_DINERS_CLUB = "/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/";
const PATTERN_DISCOVER = "/^6(?:011|5[0-9]{2})[0-9]{12}$/";
const PATTERN_JCB = "/^(?:2131|1800|35[0-9]{3})[0-9]{11}$/";
const PATTERN_MASTERCARD = "/^(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}$/";
const PATTERN_VERVE = "/^((506(0|1))|(507(8|9))|(6500))[0-9]{12,15}$/";
@ibrahimlawal
ibrahimlawal / git-ddev
Last active Aug 22, 2019
Git Scripts for speedy delivery
View git-ddev
# deploy via dev after merging remote master (requires mrm)
branch_name=$(git symbolic-ref -q HEAD)
branch_name=${branch_name##refs/heads/}
if [ -z "$branch_name" ]; then
echo Not on a branch, deploy aborted && exit 1
fi
if [ $branch_name = "master" ] || [ $branch_name = "dev" ]; then
@ibrahimlawal
ibrahimlawal / PaystackTransactionsFetcher-usage.js
Last active Aug 1, 2019
Get a list of transactions from Paystack
View PaystackTransactionsFetcher-usage.js
const paystackTransactionsFetcher = require('./PaystackTransactionsFetcher');
paystackTransactionsFetcher.fetch({
secretKey: 'sk_live_youwishiwereavalidkey___', // secret key
perPage: 100, // leave empty to fetch 50 per page
status: 'all', // leave empty to fetch only successful
startFrom: new Date('2011-01-01'), // Leave empty to fetch only a week ago
})
.then((i) => { console.log(JSON.stringify(i, null, 2)); })
.catch(console.error);
@ibrahimlawal
ibrahimlawal / PaystackFees.cs
Last active Mar 19, 2019
Add Paystack fees in CSharp
View PaystackFees.cs
using System;
public class PaystackFees
{
const Double DEFAULT_PERCENTAGE = 0.015;
const Double DEFAULT_ADDITIONAL_CHARGE = 10000;
const Double DEFAULT_THRESHOLD = 250000;
const Double DEFAULT_CAP = 200000;
private Double percentage;
@ibrahimlawal
ibrahimlawal / installing-node-with-nvm.md
Created Mar 23, 2018 — forked from d2s/installing-node-with-nvm.md
Installing Node.js for Linux & macOS with nvm
View installing-node-with-nvm.md
@ibrahimlawal
ibrahimlawal / PaystackFee.js
Last active Mar 23, 2019
Add Paystack fees in Javascript
View PaystackFee.js
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;
@ibrahimlawal
ibrahimlawal / PaystackFee.py
Last active Oct 10, 2018
Add Paystack fees in Python
View PaystackFee.py
import math
class PaystackFee:
"""Work with Paystack's Fees"""
DEFAULT_PERCENTAGE = 0.015
DEFAULT_ADDITIONAL_CHARGE = 10000
DEFAULT_THRESHOLD = 250000
DEFAULT_CAP = 200000
percentage = DEFAULT_PERCENTAGE
@ibrahimlawal
ibrahimlawal / pre-commit.sh
Last active May 18, 2017
My PHP libraries Git pre-commit hook
View pre-commit.sh
#!/bin/sh
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
@ibrahimlawal
ibrahimlawal / LC_CTYPE.txt
Created Feb 27, 2017 — forked from jampajeen/LC_CTYPE.txt
Centos warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
View LC_CTYPE.txt
vi /etc/environment
add these lines...
LANG=en_US.utf-8
LC_ALL=en_US.utf-8
@ibrahimlawal
ibrahimlawal / MyHashHMAC.cs
Created Feb 2, 2017
Paystack .NET Event Handling
View MyHashHMAC.cs
using System;
public class MyHashHMACTester
{
public static void Main()
{
// Usage sample
Console.WriteLine(MyHashHMAC.sha512WithKey("{\"event\":\"charge.success\",\"data\":{\"id\":708206,\"domain\":\"test\",\"status\":\"success\",\"reference\":\"AB8760\",\"amount\":9000,\"message\":null,\"gateway_response\":\"Successful\",\"paid_at\":\"2017-02-02T08:18:39.000Z\",\"created_at\":\"2017-02-02T08:18:13.000Z\",\"channel\":\"card\",\"currency\":\"NGN\",\"ip_address\":\"154.118.4.232\",\"metadata\":{\"cancel_action\":\"https://gbeta.gigm.com/PayStack-Response.aspx\",\"custom_fields\":[],\"referrer\":\"http://gbeta.gigm.com/Passenger-Details.aspx\"},\"log\":{\"time_spent\":22,\"attempts\":1,\"authentication\":null,\"errors\":0,\"success\":false,\"mobile\":false,\"input\":[],\"channel\":null,\"history\":[{\"type\":\"input\",\"message\":\"Filled these fields: card number, card expiry, card cvv\",\"time\":22},{\"type\":\"action\",\"message\":\"Attempted to pay\",\"time\":22}]},\"fees\":null,\"fees_split\":n
You can’t perform that action at this time.