Skip to content

Instantly share code, notes, and snippets.

View sagormax's full-sized avatar
🏠
Working from home

Rashedul Islam Sagor sagormax

🏠
Working from home
View GitHub Profile
@sagormax
sagormax / docker-compose.yml
Created October 23, 2023 04:41
WordPress docker-compose
# create a local .env file with the following 4 properties:
#
# MYSQL_DATABASE=<something>
# MYSQL_USER=<something>
# MYSQL_PASSWORD=<something>
# MYSQL_ROOT_PASSWORD=<something>
#
version: "3.8"
services:
@sagormax
sagormax / state-county-city-details.json
Last active November 28, 2021 15:00
US state-county-city details json
[{"stateName":"South Carolina","stateCode":"SC","details":[{"county":"Abbeville","countyFIPSCode":"45001","cityDetails":[{"city":"ABBEVILLE","latitude":"+34.215714","longitude":"-082.446307"},{"city":"CALHOUN FALLS","latitude":"+34.191846","longitude":"-082.490284"},{"city":"DONALDS","latitude":"+34.330362","longitude":"-082.336693"},{"city":"DUE WEST","latitude":"+34.326755","longitude":"-082.430787"},{"city":"LOWNDESVILLE","latitude":"+34.221282","longitude":"-082.631810"}]},{"county":"Aiken","countyFIPSCode":"45003","cityDetails":[{"city":"AIKEN","latitude":"+33.537730","longitude":"-081.599891"},{"city":"BATH","latitude":"+33.496998","longitude":"-081.850871"},{"city":"BEECH ISLAND","latitude":"+33.470747","longitude":"-081.863900"},{"city":"CLEARWATER","latitude":"+33.499656","longitude":"-081.864850"},{"city":"GLOVERVILLE","latitude":"+33.518235","longitude":"-081.827708"},{"city":"GRANITEVILLE","latitude":"+33.641442","longitude":"-081.792870"},{"city":"JACKSON","latitude":"+33.421714","longitude":"-08
@sagormax
sagormax / late-static-binding.php
Last active December 8, 2020 05:20
Late static binding
<?php
class User
{
public static $name = "Undefined";
public static function stateName()
{
return self::$name;
}
@sagormax
sagormax / js-nl2br-br2nl.md
Created October 28, 2020 04:08 — forked from yidas/js-nl2br-br2nl.md
JavaScript nl2br & br2nl functions

JavaScript nl2br & br2nl functions

The exchange of new line & br HTML tag could refer to PHP - nl2br() function, which uses to inserts HTML line breaks before all newlines in a string.

These JavaScript functions consider whether to use insert or replace to handle the swap.

nl2br

@sagormax
sagormax / .htaccess
Created February 1, 2020 11:12
WordPress site faster
## ENABLE GZIP COMPRESSION ##
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
@sagormax
sagormax / customroutes.php
Created January 25, 2020 13:21 — forked from samhernandez/customroutes.php
A simple class to add custom routes to Wordpress.
<?php
/**
* A class to create simple custom routes.
*
* Example usage:
*
* $theme_routes = new CustomRoutes();
* $theme_routes->addRoute(
*
@sagormax
sagormax / php-http-basic-auth.php
Created January 22, 2020 16:56 — forked from gabrysiak/php-http-basic-auth.php
PHP - HTTP Request with Basic Authentication
$username = "some-username";
$password = "some-password";
$remote_url = 'http://www.somedomain.com/path/to/file';
// Create a stream
$opts = array(
'http'=>array(
'method'=>"GET",
'header' => "Authorization: Basic " . base64_encode("$username:$password")
)
@sagormax
sagormax / .block
Created January 7, 2020 03:01 — forked from donmccurdy/.block
Custom tiles in Google Maps
license: apache-2.0
@sagormax
sagormax / polyline_decoder.js
Created December 31, 2019 05:18 — forked from ismaels/polyline_decoder.js
Javascript function to decode google maps api polyline
// source: http://doublespringlabs.blogspot.com.br/2012/11/decoding-polylines-from-google-maps.html
function decode(encoded){
// array that holds the points
var points=[ ]
var index = 0, len = encoded.length;
var lat = 0, lng = 0;
while (index < len) {
var b, shift = 0, result = 0;
@sagormax
sagormax / docker_wordpress.md
Created October 26, 2019 07:02 — forked from bradtraversy/docker_wordpress.md
Docker Compose FIle For Wordpress, MySQL & phpmyadmin

Wordpress & Docker

This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command

$ docker-compose up -d

# To Tear Down
$ docker-compose down --volumes