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 / 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 / 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
FROM php:7.0.4-fpm
RUN apt-get update && apt-get install -y libmcrypt-dev \
mysql-client libmagickwand-dev --no-install-recommends \
&& pecl install imagick \
&& docker-php-ext-enable imagick \
&& docker-php-ext-install mcrypt pdo_mysql