This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang=""> | |
<head> | |
<style> | |
#map { | |
position:absolute; | |
height: 50%; | |
width: 100%; | |
} |
OlderNewer