Skip to content

Instantly share code, notes, and snippets.

View olanipekunife's full-sized avatar
🎨

Ifeoluwa Olanipekun olanipekunife

🎨
View GitHub Profile
@olanipekunife
olanipekunife / CRC.js
Last active June 22, 2022 10:14
Credit Bureau Soap Impl
const soap = require("soap");
const host =
"https://webserver.creditreferencenigeria.net/crcweb/liverequestinvoker.asmx?WSDL";
const options = {
ignoredNamespaces: {
namespaces: [],
override: true,
},
@olanipekunife
olanipekunife / esm-package.md
Created March 3, 2022 21:26 — forked from sindresorhus/esm-package.md
Pure ESM package

Pure ESM package

The package linked to from here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
import {Dimensions} from 'react-native';
const baseWidth = 412;
const baseHeight = 896;
const maxHeightScale = 1.1;
let heightScale = Dimensions.get('window').height / baseHeight;
let fontScale = Dimensions.get('window').height / 800;
@olanipekunife
olanipekunife / ussd * to go back(1*1 format)
Created October 5, 2020 12:45
africa's talking implementation
if(!!data.text){
const chkTxt= data.text.split('**')
if(chkTxt.length > 1){
//skip the last
for(let i = 0;i<=chkTxt.length -2;i++){
const holdNew = [...chkTxt[i].split('*')]
holdNew.pop()
chkTxt[i] = holdNew.join('*')
}
@olanipekunife
olanipekunife / convertSheet.js
Created October 5, 2020 06:54
convert csv string to array
const detectNewline = string => {
if (typeof string !== 'string') {
throw new TypeError('Expected a string');
}
const newlines = string.match(/(?:\r?\n)/g) || [];
if (newlines.length === 0) {
return;
}
@olanipekunife
olanipekunife / countries+states
Created August 24, 2020 09:03
list of countries with states
[
{
"code2": "AF",
"code3": "AFG",
"name": "Afghanistan",
"capital": "Kabul",
"region": "Asia",
"subregion": "Southern Asia",
"states": [
{
@olanipekunife
olanipekunife / app.js
Created August 23, 2019 09:57 — forked from hansott/app.js
Global socket.io in an application
var http = require('http');
var sockets = require('./sockets');
var server = http.createServer(app);
sockets.connect(server);
sockets.emit('event', { message: 'This is an event!' });
@olanipekunife
olanipekunife / paginations.jsx
Last active August 19, 2019 17:02
react component that can be used with Express-REST-API-Generator
import React from 'react';
const Paginations = React.memo(({ pages, lastpage, page, prev, next, pageClick }) => {
let paginations = [], showNext = page + 3, showLast = pages - 3, lastpaginations = []
for (let i = 1; i <= pages; i++) {
//show last 3
if (i >= page - 3) {
if (i < showNext) {
paginations.push(<li key={i} className={`page-item ${page === i && 'active'}`}><button onClick={() => page !== i && pageClick(i)} className="link-button page-link">{i}</button></li>)
} else if (i > showLast) {
@olanipekunife
olanipekunife / index.js
Created February 15, 2019 08:41 — forked from mrzmyr/index.js
React Native - Detect Double Tap
var Index = React.createClass({
getInitialState: function () {
return {
lastPress: 0
}
},
onPress: function () {
var delta = new Date().getTime() - this.state.lastPress;