Skip to content

Instantly share code, notes, and snippets.

View sumonst21's full-sized avatar
💭
I may be slow to respond.

Md. Sumon Islam sumonst21

💭
I may be slow to respond.
View GitHub Profile
@sumonst21
sumonst21 / README.md
Created April 29, 2022 04:51 — forked from goodmami/README.md
Parsing JSON with regular expressions

Parsing JSON with Regular Expressions

When I learned of regular expression engines that support recursion I thought I could write a recursive-descent parser in regex. Since I've written JSON parsers a few times and it's a simple spec, I chose that as the test case. In the end I created two versions.

version 1

@sumonst21
sumonst21 / php_environment_setup_ubuntu.md
Created April 20, 2022 23:47 — forked from linkanp/php_environment_setup_ubuntu.md
PHP 5.6 Development Environment on Ubuntu 16.04

PHP 5.6 Development Environment on Ubuntu 16.04

As a PHP developer on Ubuntu, we may need to re setup our development environment sometimes. I did it already a few times, so decided to write down the steps for a typical php development environment on ubuntu. My Ubuntu version is 16.04.

Installation List

@sumonst21
sumonst21 / clickTrackEvents.js
Created April 20, 2022 09:14 — forked from jwebgordon/clickTrackEvents.js
Custom JS to add click track event listeners to all elements of a particular class This should be added to the Custom Javascript in Hubspot Events
var all_buttons = $('.buttons');
for(var i=0; i<all_buttons.length; i++){
_hsq.push(["trackClick", "#"+all_buttons.eq(i).attr('id'), "test2"+all_buttons.eq(i).attr('id')]);
}
@sumonst21
sumonst21 / hubspot.css
Created April 20, 2022 09:08 — forked from jwebgordon/hubspot.css
HS style guide
@charset "UTF-8";
html, body {
margin: 0;
padding: 0
}
h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, cite, code, del, dfn, em, img, q, s, samp, small, strike, strong, sub, sup, tt, var, dd, dl, dt, li, ol, ul, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
font-weight: normal;
@sumonst21
sumonst21 / desc.php
Created April 16, 2022 19:05 — forked from igorbenic/desc.php
How to Programmatically Change Yoast SEO Open Graph Meta | http://www.ibenic.com/programmatically-change-yoast-seo-open-graph-meta
<?php
function change_yoast_seo_og_meta() {
add_filter( 'wpseo_opengraph_desc', 'change_desc' );
}
function change_desc( $desc ) {
// This article is actually a landing page for an eBook
if( is_singular( 123 ) ) {
@sumonst21
sumonst21 / ubuntu16-apache2-mysql5-php4.md
Created April 10, 2022 21:02 — forked from samueltc/ubuntu16-apache2-mysql5-php4.md
Ubuntu 16.04, Apache 2.2, MySQL 5.0 and PHP 4.4
# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.5 LTS
Release:	16.04
Codename:	xenial

apt-get update
apt-get upgrade
@sumonst21
sumonst21 / proxmox-proxy
Created March 29, 2022 19:28 — forked from basoro/proxmox-proxy
Running Proxmox behind a single IP address
I ran into the battle of running all of my VMs and the host node under a single public IP address. Luckily, the host is just pure Debian, and ships with iptables.
What needs to be done is essentially to run all the VMs on a private internal network. Outbound internet access is done via NAT. Inbound access is via port forwarding.
Network configuration
Here’s how it’s done:
Create a virtual interface that serves as the gateway for your VMs:
@sumonst21
sumonst21 / wordpress-upload-base64.php
Created March 28, 2022 10:51 — forked from cyberwani/wordpress-upload-base64.php
Upload a base64 string as image to the WordPress media library
<?php
/**
* Save the image on the server.
*/
function save_image( $base64_img, $title ) {
// Upload dir.
$upload_dir = wp_upload_dir();
$upload_path = str_replace( '/', DIRECTORY_SEPARATOR, $upload_dir['path'] ) . DIRECTORY_SEPARATOR;
@sumonst21
sumonst21 / README.md
Created March 18, 2022 12:19 — forked from signalpoint/README.md
Bootstrap 4 Dynamic Modal with JavaScript

Use this to dynamically create and set the content of a Bootstrap 4 Modal.

In this example, we chose an onclick handler to initialize the modal (only once), and then set the content of the modal dynamically.

@sumonst21
sumonst21 / wc-auth-net-cim-save-payment-method-default-checked.php
Created March 15, 2022 22:00 — forked from maxrice/wc-auth-net-cim-save-payment-method-default-checked.php
WC Authorize.net CIM: On the payment form, default "securely save to account" checkbox to checked
<?php
// force the "securely save to account" checkbox to default to checked
function wc_auth_net_cim_save_payment_method_default_checked( $html, $form ) {
if ( empty( $html ) || $form->tokenization_forced() ) {
return $html;
}
return str_replace( 'type="checkbox"', 'type="checkbox" checked="checked"', $html );
}