Skip to content

Instantly share code, notes, and snippets.


Sourov Roy sourovroy

View GitHub Profile
sourovroy / script.js
Created Jun 30, 2022
Update WooCommerce fragment cache
View script.js
sourovroy / preview-email.php
Created Jul 13, 2021
Preview WooCommerce Email
View preview-email.php
* Plugin Name: Preview Email
* Author: Sourov
function sourov_preview_woo_emails() {
$mailer = WC()->mailer();
$email = $mailer->emails['WC_Email_Customer_Processing_Order'];
sourovroy / languages.php
Last active Aug 19, 2021
PHP array to get the language by country locale.
View languages.php
return [
'bs' => 'Bosnian',
'ee_TG' => 'Ewe (Togo)',
'ms' => 'Malay',
'kam_KE' => 'Kamba (Kenya)',
'mt' => 'Maltese',
'ha' => 'Hausa',
'es_HN' => 'Spanish (Honduras)',
sourovroy / hooks.json
Created May 7, 2020
Ubuntu webhook and Supervisor setup
View hooks.json
"id": "laravel-deploy",
"execute-command": "/home/sourov/hooks/",
"command-working-directory": "/home/sourov/sites/github-actions",
"trigger-rule": {
"match": {
"type": "value",
"value": "development",
"parameter": {
sourovroy / CI.yml
Last active May 7, 2020
GitHub Actions for Laravel application
View CI.yml
name: Continuous Integration
- master
- develop
- 'feature/**'
sourovroy / Dockerfile
Created Jun 27, 2019
Ubuntu Dockerfile for PHP and Node
View Dockerfile
# Download base image ubuntu 18.04
FROM ubuntu:18.04
ARG DEBIAN_FRONTEND=noninteractive
# replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# Update software repository and install cURL & Wget
sourovroy / Dockerfile
Created Jun 27, 2019
Alpine Dockerfile for PHP, Node and Git
View Dockerfile
FROM alpine:3.10
# Install cURL, Zip, Vim
RUN apk update && apk add curl zip vim
# Install PHP
RUN apk add php7 php7-common php7-curl php7-json php7-zip php7-mbstring php7-openssl php7-phar php7-xml
# Install composer
RUN curl -sS | php -- \
sourovroy / functions.php
Created Feb 14, 2018
WordPress allow any page to add extra url with it
View functions.php
* Custom rewrite rule for career page
add_action('init', function(){
sourovroy / show-error.php
Last active Jan 24, 2018
Display PHP error. Enable debuging
View show-error.php
// Show all php errors
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
// END
sourovroy /
Last active Dec 19, 2017
Show git branch name in ubuntu terminal

Show git branch name in ubuntu terminal

Add these lines in your ~/.bashrc file

# Show git branch name
parse_git_branch() {
 git branch 2&gt; /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'