Skip to content

Instantly share code, notes, and snippets.

@rad73
rad73 / gist:60492e96fbdda3d7f770
Created October 7, 2015 20:02 — forked from billerickson/gist:3698476
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(
@rad73
rad73 / dabblet.css
Created January 3, 2016 08:25 — forked from csssecrets/dabblet.css
Polka dot
/**
* Polka dot
*/
background: #655;
background-image: radial-gradient(tan 20%, transparent 0),
radial-gradient(tan 20%, transparent 0);
background-size: 30px 30px;
background-position: 0 0, 15px 15px;
@rad73
rad73 / dabblet.css
Created January 3, 2016 08:25 — forked from csssecrets/dabblet.css
Polka dot
/**
* Polka dot
*/
background: #655;
background-image: radial-gradient(tan 20%, transparent 0),
radial-gradient(tan 20%, transparent 0);
background-size: 30px 30px;
background-position: 0 0, 15px 15px;
@rad73
rad73 / dabblet.css
Created March 30, 2016 19:42 — forked from csssecrets/dabblet.css
Vertical stripes
/**
* Vertical stripes
*/
background: linear-gradient(to right, #fb3 50%, #58a 0);
background-size: 30px 100%;
@rad73
rad73 / dabblet.css
Created March 31, 2016 18:43 — forked from csssecrets/dabblet.css
Native modal dialog (limited support)
/**
* Native modal dialog (limited support)
*/
dialog::backdrop {
background: rgba(0,0,0,.8)
}
@rad73
rad73 / shopify-auto-currencies-switcher.js
Created September 2, 2017 16:58 — forked from chrisgrabinski/shopify-auto-currencies-switcher.js
(Shopify) Automatically change a shop's currency based on the customer's geolocation
// Dependencies
// - https://github.com/carolineschnapp/currencies
// Don't change currency if Cookie has been already set
if (Currency.cookie.read() == null) {
jQuery.ajax( {
url: '//freegeoip.net/json/',
type: 'GET',
dataType: 'jsonp',
// XPath CheatSheet
// To test XPath in your Chrome Debugger: $x('/html/body')
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/
// 0. XPath Examples.
// More: http://xpath.alephzarro.com/content/cheatsheet.html
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class
@rad73
rad73 / php-webscraping.md
Created January 28, 2018 11:06 — forked from anchetaWern/php-webscraping.md
web scraping in php

Have you ever wanted to get a specific data from another website but there's no API available for it? That's where Web Scraping comes in, if the data is not made available by the website we can just scrape it from the website itself.

But before we dive in let us first define what web scraping is. According to Wikipedia:

{% blockquote %} Web scraping (web harvesting or web data extraction) is a computer software technique of extracting information from websites. Usually, such software programs simulate human exploration of the World Wide Web by either implementing low-level Hypertext Transfer Protocol (HTTP), or embedding a fully-fledged web browser, such as Internet Explorer or Mozilla Firefox. {% endblockquote %}

@rad73
rad73 / WooCommerce: quantity input for simple product to loop
Created October 14, 2018 20:45
WooCommerce: quantity input for simple product to loop
add_filter( 'woocommerce_loop_add_to_cart_link', 'bb_quantity_input_simple_products_archive', 10, 2 );
function bb_quantity_input_simple_products_archive( $html, $product ) {
if ( $product && $product->is_type( 'simple' ) && $product->is_purchasable() && $product->is_in_stock() && ! $product->is_sold_individually() ) {
$html = '<form action="' . esc_url( $product->add_to_cart_url() ) . '" class="cart" method="post" enctype="multipart/form-data">';
$html .= woocommerce_quantity_input( array(), $product, false );
$html .= '<button type="submit" class="button alt">' . esc_html( $product->add_to_cart_text() ) . '</button>';
$html .= '</form>';
}
return $html;
}
@rad73
rad73 / HTACCESS: Header Vary, Cache, Compression, SSL Re-Direct, Login Protection, Comment Direct Access Block, Query Strings, Folder & Files Protection AND Under Construction Page Re-Direct
Created October 14, 2018 20:45
HTACCESS: Header Vary, Cache, Compression, SSL Re-Direct, Login Protection, Comment Direct Access Block, Query Strings, Folder & Files Protection AND Under Construction Page Re-Direct
<IfModule mod_headers.c>
<FilesMatch ".(js|css|xml|gz|html)$">
Header append Vary: Accept-Encoding
</FilesMatch>
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"