Skip to content

Instantly share code, notes, and snippets.

View hollyboom's full-sized avatar

Catalin Badea hollyboom

  • Rumania
View GitHub Profile
@hollyboom
hollyboom / jack-in-the-box-init.js
Created March 18, 2016 23:42 — forked from srikat/jack-in-the-box-init.js
Scroll animations in WordPress using Animate.css, Jack In The Box and Waypoints. http://sridharkatakam.com/scroll-animations-wordpress-using-animate-css-jack-box-waypoints/
jQuery(function() {
<?php
function custom_wcaf_fee_amount_subtotal( $subtotal ) {
$subtotal = 0;
$category_id = '61'; // Your category ID here.
$cart_items = WC()->cart->get_cart();
foreach ( $cart_items as $key => $item ) {
@hollyboom
hollyboom / countries.sql
Created March 29, 2017 19:06 — forked from adhipg/countries.sql
Sql dump of all the Countries, Country Codes, Phone codes.
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
add_filter('wp_get_attachment_image_attributes', 'change_attachement_image_attributes', 20, 2);
function change_attachement_image_attributes( $attr, $attachment ){
// Get post parent
$parent = get_post_field( 'post_parent', $attachment);
// Get post type to check if it's product
$type = get_post_field( 'post_type', $parent);
if( $type != 'product' ){
return $attr;
@hollyboom
hollyboom / gist:58647dec3e453e62f949f61907747e5d
Created February 11, 2018 08:37 — forked from mikejolley/gist:1622323
WooCommerce - Change default catalog sort order
/**
* This code should be added to functions.php of your theme
**/
add_filter('woocommerce_default_catalog_orderby', 'custom_default_catalog_orderby');
function custom_default_catalog_orderby() {
return 'date'; // Can also use title and price
}
@hollyboom
hollyboom / mod_rewrites
Last active June 21, 2018 08:23 — forked from redesigned/mod_rewrites
Helpful Mod Rewrites and .htaccess rules
#### IMAGE PROTECTION ####
#protect images from hotlinking
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?domainname.com [NC]
RewriteRule \.(jpg|jpeg|png|gif|bmp|tiff|svg)$ - [NC,F,L]
#protect images from hotlinking send new image
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?domainname.com [NC]
@hollyboom
hollyboom / erc20-token-sample.sol
Created March 12, 2021 12:01 — forked from bajcmartinez/erc20-token-sample.sol
Necessary code to generate an ERC20 Token
pragma solidity ^0.4.24;
// ----------------------------------------------------------------------------
// Sample token contract
//
// Symbol : LCST
// Name : LCS Token
// Total supply : 100000
// Decimals : 2
// Owner Account : 0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe
@hollyboom
hollyboom / BasicERC20.sol
Created March 12, 2021 13:51 — forked from giladHaimov/BasicERC20.sol
Basic ERC20 implementation
pragma solidity ^0.4.19;
contract ERC20Basic {
string public constant name = "ERC20Basic";
string public constant symbol = "BSC";
uint8 public constant decimals = 18;
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);