Skip to content

Instantly share code, notes, and snippets.

@Shoora
Shoora / parser.php
Created January 26, 2018 11:48 — forked from martinsik/parser.php
Simple sport results parser in PHP using XPath. For more information visit http://martinsikora.com/parsing-html-pages-using-xpath
<?php
$curl = curl_init('http://www.livescore.com/soccer/england/');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10');
$html = curl_exec($curl);
curl_close($curl);
if (!$html) {
<div class="col6">
<div class="group">[text* full-name placeholder "*Insert Full Name"]</div>
<div class="group">[email* the-email placeholder "*Insert Email"]</div>
</div>
<div class="col6">
<div class="group">[textarea* the-message placeholder "*Write your message here"]</div>
</div>
<div class="col12">
@Shoora
Shoora / .htaccess
Created June 8, 2018 18:28 — forked from ludo237/.htaccess
The ultimate .htaccess file. Please feel free to fork it, edit it and let me know what do you think about it.
# Apache configuration file
# httpd.apache.org/docs/2.2/mod/quickreference.html
# Note .htaccess files are an overhead, this logic should be in your Apache
# config if possible: httpd.apache.org/docs/2.2/howto/htaccess.html
# Techniques in here adapted from all over, including:
# Kroc Camen: camendesign.com/.htaccess
# perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
# Sample .htaccess file of CMS MODx: modxcms.com
# This is the free sample of .htaccess from 6GO s.r.l.
# @author Claudio Ludovico Panetta (@Ludo237)
@Shoora
Shoora / idna_convert.class.php
Created June 17, 2018 11:53 — forked from AgelxNash/idna_convert.class.php
Encode/decode Internationalized Domain Names
<?php
// {{{ license
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
//
// +----------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU Lesser General Public License as |
// | published by the Free Software Foundation; either version 2.1 of the |
// | License, or (at your option) any later version. |
@Shoora
Shoora / trackEvents.js
Created July 1, 2018 14:39 — forked from murielg/trackEvents.js
Google Analytics Track Events using Universal Analytics
$.trackEvents({
'/ #header #nav #nav-item-1 a ': ['Header', 'Nav Click', 'Section Name'],
'/ #header #nav #nav-item-2 a ': ['Header', 'Nav Click', 'Section Name'],
'/ #header #nav #nav-item-3 a ': ['Header', 'Nav Click', 'Section Name'],
'/ #header #nav #nav-item-4 a ': ['Header', 'Nav Click', 'Section Name'],
'/ #header #nav #nav-item-5 a ': ['Header', 'Nav Click', 'Section Name'],
'/ #header #nav #nav-item-7 a ': ['Header', 'Nav Click', 'Section Name'
]});
jQuery.trackEvents = (function ($) {
@Shoora
Shoora / website-checklist.md
Created July 29, 2018 13:59 — forked from davidsword/website-checklist.md
checklists for every stage of a WordPress websites life

WEBSITE QUALITY

Before start

  • Screenshots and PageSpeed / GTMetic old ratings

WordPress Environment

  • Comment Spam Protector
  • Client users are created
$(document).ready(function() {
// Select all links with hashes
$('a[href*="#"]')
// Remove links that don't actually link to anything
.not('[href="#"]')
.not('[href="#0"]')
.click(function(event) {
// On-page links
if (
location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '')
@Shoora
Shoora / ga-anchor-events.js
Created October 3, 2018 04:36 — forked from ao5357/ga-anchor-events.js
GA Event for anchors in jQuery 1.7+
var $body = jQuery('body');
$body.on('click', 'a', function() {
var $this = $(this),
thisHref = $this.attr('href');
if (thisHref.length
&& thisHref.substring(0, 1) === '#'
&& typeof ga === 'function'
) {
ga('send', 'event', {
<?php
/**
* Plugin Name: Disable ACF on Frontend
* Description: Provides a performance boost if ACF frontend functions aren't being used
* Version: 1.0
* Author: Bill Erickson
* Author URI: http://www.billerickson.net
* License: MIT
* License URI: http://www.opensource.org/licenses/mit-license.php
*/
@Shoora
Shoora / product.php
Created October 3, 2018 04:40
Opencart product model optimization
<?php
class ModelCatalogProduct extends Model
{
public function updateViewed($product_id)
{
$this->db->query("UPDATE " . DB_PREFIX . "product SET viewed = (viewed + 1) WHERE product_id = '" . (int)$product_id . "'");
}
public function getProduct($product_id)