Skip to content

Instantly share code, notes, and snippets.

Vijayan gvgvgvijayan

Block or report user

Report or block gvgvgvijayan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gvgvgvijayan
gvgvgvijayan / archive-product.php
Created Feb 1, 2020
The snippet to explain overriding WooCommerce template. Website: www.vijayan.in
View archive-product.php
<header class="woocommerce-products-header">
<?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>
<h1 class="woocommerce-products-header__title page-title"><?php echo strtoupper(woocommerce_page_title(false)); ?></h1>
<?php endif; ?>
<?php
/**
* Hook: woocommerce_archive_description.
*
* @hooked woocommerce_taxonomy_archive_description - 10
@gvgvgvijayan
gvgvgvijayan / functions.php
Created Feb 1, 2020
To detect rendered template in WordPress
View functions.php
<?php
add_action('wp_head', function () {
global $template;
echo $template;
});
View apache2.conf
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
@gvgvgvijayan
gvgvgvijayan / .htaccess
Created Dec 22, 2019
masquerade config for php as image
View .htaccess
RewriteEngine On
RewriteBase /
RewriteRule ^image\.jpg image.php [L,QSA]
View dynamic_image_captcha.php
<?php
$wide = 1080;
$height = 50;
$handle = imagecreatetruecolor($wide, $height); #create a 640px wide 480px height image. Consider this like canvas to draw.
$green = imagecolorallocate($handle, 0, 255, 0); #assign green color
$black = imagecolorallocate($handle, 0, 0, 0); #assign black color
imagefilledrectangle($handle, 0, 0, $wide, $height, $green); #Create filled rectangle with green color. Consider like this the shape drawn over the canvas.
View image_view.html
<img src="http://localhost/image.php">
@gvgvgvijayan
gvgvgvijayan / basic_image.php
Created Dec 22, 2019
This is used to create basic filled rectangle image using PHP
View basic_image.php
<?php
$handle = imagecreatetruecolor(640, 480); #create a 640px wide 480px height image. Consider this like canvas to draw.
$green = imagecolorallocate($handle, 0, 255, 0); #assign green color
imagefilledrectangle($handle, 0, 0, 640, 480, $green); #Create filled rectangle with green color. Consider like this the shape drawn over the canvas.
# Jpeg conversion
header("Content-type: image/jpg");
imagejpeg($handle);
View country.py
import requests
import openpyxl
import time
#CONSTANTS
API_URL = 'https://restcountries.eu/rest/v2/name/'
def extract_country_details(search_term):
@gvgvgvijayan
gvgvgvijayan / tombstone.log
Created Aug 11, 2019
Log generated by tombstone
View tombstone.log
2019-08-11T18:37:51+05:30 - Vampire detected: tombstone("11-Aug-19", "Vijayan"), in file /var/www/html/tombstone/index.php:15, in function DeadCode->called, invoked by deadCodeTrigger
2019-08-11T19:41:47+05:30 - Vampire detected: tombstone("11-Aug-19", "Vijayan"), in file /var/www/html/tombstone/index.php:15, in function DeadCode->called, invoked by deadCodeTrigger
2019-08-11T19:44:20+05:30 - Vampire detected: tombstone("11-Aug-19", "Vijayan"), in file /var/www/html/tombstone/index.php:15, in function DeadCode->called, invoked by deadCodeTrigger
@gvgvgvijayan
gvgvgvijayan / tombstone_marker_sample.php
Created Aug 11, 2019
This gist show how we can detect the dead code in our codebase
View tombstone_marker_sample.php
<?php
require_once('vendor/autoload.php');
use Helper\TombstoneHelper\TombstoneHelper;
class DeadCode {
private $tombstoneHelper;
public function __construct() {
You can’t perform that action at this time.