Skip to content

Instantly share code, notes, and snippets.

View Sadicko's full-sized avatar
🎯
Focusing

SADICK ODAI Sadicko

🎯
Focusing
View GitHub Profile
@Sadicko
Sadicko / Tour.java
Created November 24, 2016 17:25 — forked from Sable-Shinigami/Tour.java
Travelling Salesman Assignment for Algorithms class
/*
* This is my code for a Travelling Salesman Problem assignment from college.
* I was supposed to create a Hamilton Cycle of N points on a 2D plane i.e. find the shortest
* path that visits all points exactly once and returns to the starting point.
* I implemented both the Smallest Insertion and Nearest Insertion algorithms which inserts
* a point where it will create the smallest increase in the total length of the cycle and
* insert a point where it is nearest to an other point already on the cycle respectively.
*
* In our brief we were informed that speed was the most important factor and so I decided
* to try and squeeze every last nanosecond out of the program... even at the cost of the memory.
@Sadicko
Sadicko / gist:090fc62133ae5fa506a16b376280dcaa
Created May 25, 2019 07:57 — forked from webaware/gist:4048580
basic example of populating a form from a database using AJAX and JSON, jQuery version
<?php
// jQuery version of https://gist.github.com/3110728
/*
-- the SQL database table
create table form_ajax (
ID varchar(5) not null,
Name varchar(100),
Address varchar(100),
@Sadicko
Sadicko / Formatting date in jquery
Created June 9, 2019 17:35
How to format a date using jquery
$.date = function(dateObject) {
var d = new Date(dateObject);
var day = d.getDate();
var month = d.getMonth() + 1;
var year = d.getFullYear();
if (day < 10) {
day = "0" + day;
}
@Sadicko
Sadicko / account.php
Created September 29, 2019 07:47
validating user signup
<?php
//including the header
include 'header.php'
?>
<?php
//checking if all fields in the signup are empty
$url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
if (strpos($url, 'error=empty') !== false) {
echo "Fill out all fields";
@Sadicko
Sadicko / momo-requesttopay.php
Last active October 28, 2019 15:40
Request to pay
require_once 'HTTP/Request2.php';
$request = new \Http_Request2('https://sandbox.momodeveloper.mtn.com/collection/v1_0/requesttopay');
$url = $request->getUrl();
$token = Collections::token(); //these is just a function that generate the token, it works fine
$profileKey = Details::profileKey(); //these is just a function that get the apiu key, it works fine
$x_reference = Gen_uuid::uuid(); //these is just a function that generate the uuid, it works fine
@Sadicko
Sadicko / EventServiceProvider.php
Last active February 24, 2020 15:01
Sending a welcome message after user verify his email using markdown in laravel
<!--App/Providers/EventServiceProvider.php -->
<?php
namespace App\Providers;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
@Sadicko
Sadicko / steps-to-follow.text
Last active March 26, 2020 11:04
Sending Emails using Laravel event and listeners
Step 1. Creating event and listener
There are two ways to creating event and listeners
First way:
1. Open "App\Providers\EventServiceProvider.php"
2. Inside the "protected $listen" array, add the following. Change the event name and listener to your deside name.
'App\Events\EmployerWelcomeMail' => [
'App\Listeners\SendEmployerWelcomeMail',
],
<!-- Modify this according to your requirement -->
<h3>
Redirecting to duckdev.com after <span id="countdown">10</span> seconds
</h3>
<!-- JavaScript part -->
<script type="text/javascript">
// Total seconds to wait
var seconds = 10;
@Sadicko
Sadicko / phonenumber_match.php
Created August 20, 2020 11:22 — forked from maaddae/phonenumbers.php
Trying out the preg_match php function to match Ghana numbers.
<?php
// Regex quick reference
/*******************************************************************************
[abc] A single character: a, b or c
[^abc] Any single character but a, b, or c
[a-z] Any single character in the range a-z
[a-zA-Z] Any single character in the range a-z or A-Z
^ Start of line
@Sadicko
Sadicko / index.html
Created March 1, 2021 16:09 — forked from arkamedus/index.html
Google maps search nearest location
<!doctype html>
<html lang="">
<head>
<style>
#map {
position:absolute;
height: 50%;
width: 100%;
}