Skip to content

Instantly share code, notes, and snippets.

View webmechanicx's full-sized avatar
🎯
reinventing

Farhadur Rahim webmechanicx

🎯
reinventing
View GitHub Profile
@webmechanicx
webmechanicx / stripe-credit-card-numbers.md
Created December 12, 2020 16:26 — forked from rymawby/stripe-credit-card-numbers.md
Stripe test credit card numbers for use in development

#Test credit card numbers to use when developing with Stripe

4242424242424242 Visa

4012888888881881 Visa

4000056655665556 Visa (debit)

@webmechanicx
webmechanicx / readme.md
Last active February 4, 2020 16:55
Setup AWS Cronjob

Setup Cronjob in Amazon AWS

Step:1

$ crontab -e

Step:2

Press i
@webmechanicx
webmechanicx / htaccess.md
Last active January 23, 2020 18:50
How do I redirect HTTP traffic to HTTPS on my Classic Load Balancer in ELB
@webmechanicx
webmechanicx / aws-linux-ami-2018030-hvm-ssd.md
Last active May 6, 2020 15:42
LAMP (Linux, Apache, MySQL, PHP) web server on an Amazon EC2 Linux instance

Install and start the LAMP web server

Step1:

First thing you have to connect to ssh using macos or putty for windows by added the downloaded key file. Run the following command:

sudo yum update -y

The above command ensure that all of your software packages are up to date.

Step2: Now install packages in your current instance.

@webmechanicx
webmechanicx / aws-lamp-ubuntu-18_0_4.md
Last active April 7, 2021 14:27
How To Install LAMP On Ubuntu 16.04 or 18.04 – EC2 Instance

How To Install LAMP On Ubuntu 16.04 – EC2 Instance

Anyone who knows a little bit about the Linux and UNIX platforms, he/she must be heard about the LAMP Stack. LAMP Stack is the group of services that work together in order to serve the dynamic websites and web apps. The LAMP stack can be installed and configured on almost all Linux variants such as Amazon Linux, Ubuntu, Red Hat, and Fedora. In this tutorials, we will explain how to install LAMP on Ubuntu 16.04 EC2 instance. Generally, LAMP stack consists of the following components:

  • L= Linux as the operating system platform.
  • A= Apache as the Web server
  • M= MySQL as the database server
  • P= PHP as the supportive language
@webmechanicx
webmechanicx / gist:894ab24d6bb71718a21a78de6df1d781
Created May 12, 2017 18:00
Remove of index.php in your Joomla! URLs
## To remove the /index.php/ part from all URLs, add two lines after the RewriteEngine statement:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/index\.php/
RewriteRule ^index.php/(.*) /$1 [R,L]
## You can also add two lines to remove the .html suffix if it has been turned on before:
RewriteEngine On
RewriteCond %{REQUEST_URI} \.html$
RewriteRule (.*)\.html$ /$1 [R,L]
@webmechanicx
webmechanicx / index.html
Last active May 3, 2017 19:04
Select an option by its text, If you need to check if a selectbox has an option whose TEXT is a specific value. Example JIT site
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Textbox Value to Switch Selectbox</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
</head>
<body>
<input id="textvalue" type="text" value="Boy">
<select id="mySelect">
@webmechanicx
webmechanicx / jomloader.php
Created March 24, 2017 16:17
Load the Joomla! Framework in a PHP Script
<?php
define( '_JEXEC', 1 );
// JPATH_BASE should point to Joomla!'s root directory
define( 'JPATH_BASE', realpath(dirname(__FILE__) .'/' ) );
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
$user =& JFactory::getUser();
@webmechanicx
webmechanicx / getDateDiff.php
Created June 25, 2016 01:30
Get human readable time difference between two given dates
/* @param mixed $time1 a time (string or timestamp)
* @param mixed $time2 a time (string or timestamp)
* @param integer $precision Optional precision
* @return string time difference
*/
function get_date_diff( $time1, $time2, $precision = 2 ) {
// If not numeric then convert timestamps
if( !is_int( $time1 ) ) {
// encode(decode) html text into html entity
var decodeHtmlEntity = function(str) {
return str.replace(/&#(\d+);/g, function(match, dec) {
return String.fromCharCode(dec);
});
};
var encodeHtmlEntity = function(str) {
var buf = [];
for (var i=str.length-1;i>=0;i--) {