Skip to content

Instantly share code, notes, and snippets.

View firefoxrebo's full-sized avatar

Mohammed Yehia Abdul Mottalib firefoxrebo

View GitHub Profile
@firefoxrebo
firefoxrebo / vld
Created July 24, 2017 19:31
VLD installation
The extension is not finished (and probably will never be finished). If you have questions, feel free to send me an e-mail.
You can get the source from Github:
git clone https://github.com/derickr/vld.git vld
Here are the instructions to get it to work:
cd into the newly checked-out directory.
Create the configure script: phpize
Now run "./configure" followed by "make install".
@firefoxrebo
firefoxrebo / CreateSSLSelfSignedCertificate.sh
Created May 30, 2017 13:23
A Self-signed Certificate Creator For MacOS Running on top of built-in Apache Software
#!/usr/bin/env bash
echo "Enter Apache Virtual Host Name <ex: www.abc.com>:"
read _server_name
# The v3 file will sign a version 3 of the certificate and
# will fix the missing.SubjectAltName problem in Chrome
cat > "/etc/apache2/ssl/v3.ext" << EOF1
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
@firefoxrebo
firefoxrebo / geodata.php
Created March 31, 2017 19:20
A simple php class that retreives user's geo location data using a free api
<?php
class GeoData
{
public $id;
public $propertyId;
public $ipaddress;
public $created;
public $returnVisit;
public $userAgentString;
@firefoxrebo
firefoxrebo / builder.php
Last active September 10, 2023 21:31
Builder Design Pattern Example
<?php
// Builder Design Pattern
// Product
class SmartPhone
{
public $cpu;
public $gpu;
@firefoxrebo
firefoxrebo / factorymethod.php
Created March 28, 2017 16:20
Descriping the factory method design pattern
<?php
// Explaining the Factory Method Pattern
abstract class Student
{
public $name;
public $level;
// The factory method doesn't know which type of certificates to issue
// instead subclasses can define that type
@firefoxrebo
firefoxrebo / SessionHandler.php
Created September 8, 2015 13:15
A Custom Session Handler
define('SESSION_SAVE_PATH', dirname(realpath(__FILE__)).DIRECTORY_SEPARATOR.'sessions');
class MySessionHandler extends SessionHandler
{
private $sessionName = 'MYSESS';
private $sessionMaxLifeTime = 0;
private $sessionHTTPOnly = true;
private $sessionSecure = false;
private $sessionPath = '/';
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script>
// Check if the Notification Object/Function exists
if("Notification" in window) {
@firefoxrebo
firefoxrebo / arabicstringlength
Created March 4, 2015 20:06
Calculates the arabic string length in PHP v1
function arStringLength($str)
{
if(mb_detect_encoding($str) == 'UTF-8') {
$str = utf8_decode($str);
}
return strlen($str);
}
@firefoxrebo
firefoxrebo / index.php
Created September 13, 2012 03:58
XAMPP INDEX FILE
<?php
if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
$uri = 'https://';
} else {
$uri = 'http://';
}
$uri .= $_SERVER['HTTP_HOST'];
header('Location: '.$uri.'/xampp/');
exit;
?>
@firefoxrebo
firefoxrebo / gist:3110843
Created July 14, 2012 11:58
My Reset File
@charset utf-8;
/*
Eng. Mohammed Yehia Abdul Mottalib
CSS Reset
Note: This reset might and might not work for you so please
be sure to take some time to go through it before using it. I don't
use some tags like mark ins and so on so i excluded then from the list