Skip to content

Instantly share code, notes, and snippets.

View gr1zix's full-sized avatar
🎯
Focusing

Grizix gr1zix

🎯
Focusing
View GitHub Profile
@gr1zix
gr1zix / MyToken.sol
Created June 8, 2024 19:50
Solidity token contract example
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
@gr1zix
gr1zix / MyNFT.sol
Created June 8, 2024 19:31
NFT Smart-contract example
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
interface IERC165 {
function supportsInterface(bytes4 interfaceID)
external
view
returns (bool);
}
@gr1zix
gr1zix / gutenberg-button.js
Created June 2, 2024 11:54 — forked from junaidbhura/gutenberg-button.js
WordPress Gutenberg open button in a new window
/**
* Button.
*/
import wp from 'wp';
const { __ } = wp.i18n;
const { addFilter } = wp.hooks;
const { createHigherOrderComponent } = wp.compose;
const { Fragment, cloneElement } = wp.element;
@gr1zix
gr1zix / function.php
Created April 16, 2024 17:04 — forked from mattclements/function.php
Wordpress Disable Comments (add to function.php)
<?php
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}
@gr1zix
gr1zix / ba.sh
Created January 8, 2024 20:27 — forked from bvolpato/ba.sh
Install Chrome Driver with Xvfb (Ubuntu Server)
#!/bin/bash
# Chrome Repo
sudo apt-get install fonts-liberation xdg-utils libxss1 libappindicator1 libindicator7
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome*.deb
sudo apt-get update
# Download
@gr1zix
gr1zix / robots.txt
Created October 30, 2023 15:02
Wordpress robots.txt basic
User-agent: *
Disallow: /cgi-bin
Disallow: /?
Disallow: /admin/
Disallow: /login/
Disallow: /wp-
Disallow: *?p=
Disallow: *?s=
Disallow: *&s=
Disallow: /search/
@gr1zix
gr1zix / index.html
Created September 12, 2021 21:08
Async custom or external scripts & styles loading which need to be used after website interact (Best way to load big files like lottie scenes on Base64 stored in json which have size ~10M)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script type="text/javascript">
// Async custom or external scrips & styles loading
(function() {
var lazyLoaded = false;
@gr1zix
gr1zix / index.html
Last active September 12, 2021 20:57
Google and custom fonts async loading
<!DOCTYPE html>
<html lang="en" class="fonts-loading">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script type="text/javascript">
// Lib: https://github.com/typekit/webfontloader
// Async font loading
WebFontConfig = {
@gr1zix
gr1zix / functions.php
Last active September 13, 2021 11:02
Wordpress brutforce security and prevent username visibility
<?php
/** Disable XML-RPC - is a URL which hacher always used in first for Brute-Force attacks website with no using auth form */
add_filter('xmlrpc_enabled', '__return_false');
/** Hide username from comments */
function remove_comment_author_class( $classes ) {
foreach( $classes as $key => $class ) {
if(strstr($class, "comment-author-")) {
unset( $classes[$key] );
@gr1zix
gr1zix / functions.php
Last active September 13, 2021 11:02
Elementor register scripts on elementor template to overwrite the theme defaults
<?php
if (!function_exists('app_get_theme_version')) {
function app_get_theme_version() {
$theme_info = wp_get_theme();
if ( is_child_theme() ) {
$theme_info = wp_get_theme($theme_info->parent_theme);
}
$theme_version = $theme_info->display('Version');