Skip to content

Instantly share code, notes, and snippets.

View CeoFred's full-sized avatar
🌎
Global

Johnson-Awah Alfred CeoFred

🌎
Global
View GitHub Profile
@CeoFred
CeoFred / filter.php
Created June 4, 2019 02:27
Filter Request Data
function sanitize($data){
trim($data);
htmlspecialchars($data);
htmlentities($data);
strip_tags($data);
return $data;
}
@CeoFred
CeoFred / urlcheck.php
Created June 4, 2019 02:29
An algorithm to check for request parameters with _urls and validate them
foreach ($_REQUEST as $key => $value) {
$ex = explode('_',$key);
foreach ($ex as $k => $v) {
if($v == 'url'){
$url = filter_var($value,FILTER_VALIDATE_URL,FILTER_FLAG_HOST_REQUIRED);
if(!$url){
@CeoFred
CeoFred / fileuploads.php
Created June 4, 2019 02:31
uploadfiles with size and type check in php
$logo = isset($_FILES['logo']) ? $_FILES['logo'] : null;
if ($logo['size'] > 300000) {
echo 'File size too large';
return;
}
$type = explode('/', $logo['type']);
@CeoFred
CeoFred / about Me .MD
Last active June 4, 2019 02:59
#Who-am-I?

Who am I?

Well I am Johnson-Awah Alfred

Awesome Me

A GDG FUTO Co-Orgnizer

GDG FUTO Co-Organizer

@CeoFred
CeoFred / settings.json
Created January 31, 2020 22:00
My VS Code settings
{"editor.formatOnSave": false,
"editor.detectIndentation": true,
"editor.fontSize": 15,
"editor.lightbulb.enabled": true,
"editor.parameterHints.enabled": true,
"editor.fontFamily": "Fira Code",
"editor.fontLigatures": true,
"editor.rulers": [],
"editor.snippetSuggestions": "top",
"editor.wordBasedSuggestions": false,
@CeoFred
CeoFred / solution.js
Created July 23, 2020 21:34 — forked from gitfaf/solution.js
Solves lycanthrope's log problem from eloquent javascript.
/* Data from http://eloquentjavascript.net/code/#4 */
/* phi logic from http://www.pmean.com/definitions/phi.htm */
var JOURNAL = [
{"events":["carrot","exercise","weekend"],"squirrel":false},
{"events":["bread","pudding","brushed teeth","weekend","touched tree"],"squirrel":false},
{"events":["carrot","nachos","brushed teeth","cycling","weekend"],"squirrel":false},
{"events":["brussel sprouts","ice cream","brushed teeth","computer","weekend"],"squirrel":false},
{"events":["potatoes","candy","brushed teeth","exercise","weekend","dentist"],"squirrel":false},
{"events":["brussel sprouts","pudding","brushed teeth","running","weekend"],"squirrel":false},
@CeoFred
CeoFred / 1_Storage.sol
Created October 31, 2020 19:51
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.11+commit.c082d0b4.js&optimize=false&gist=
pragma solidity >=0.4.22 <0.7.0;
/**
* @title Storage
* @dev Store & retrieve value in a variable
*/
contract Storage {
uint256 number;
@CeoFred
CeoFred / cert.conf
Last active December 19, 2020 21:02
The following files are used in one of my blog post which talks about setting up ssl for apache server found here https://blog.codemon.me/fix-request-redirecting-to-https-secured-connection-on-local-codeigniter-3
[ req ]
default_bits = 2048
default_keyfile = server-key.pem
distinguished_name = subject
req_extensions = req_ext
x509_extensions = x509_ext
string_mask = utf8only
[ subject ]
Here are some products that you can use to build your fintech app
## SMS
Termii
Twilio
Interswitch Digital (Vanso)
## Card and account charge
/**
*Submitted for verification at Etherscan.io on 2021-09-05
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// [MIT License]
/// @title Base64