Skip to content

Instantly share code, notes, and snippets.

View garyconstable's full-sized avatar
🏠
Working from home

Gary Constable garyconstable

🏠
Working from home
View GitHub Profile
@garyconstable
garyconstable / magento_cacheclean.MD
Created November 29, 2018 10:39
Magento - clean a cache type

Clear a cache type in Magento

Using php bin/magento cache:clean you can specify(comma-separated) cache types you want to clean.

Supported types:

config, layout, block_html, collections, reflection, db_ddl, eav, customer_notification, target_rule, full_page, config_integration, config_integration_api, translate, config_webservice

@garyconstable
garyconstable / getSetting.php
Created November 26, 2018 22:08
Craft 2 - Get Config Setting
<?php
$tmp_default = \Craft\craft()->config->get('default_section', 'applenews');
@garyconstable
garyconstable / writelog.php
Created November 26, 2018 22:07
Craft 2 - Write to log file.
<?php
\Craft\Craft::log("===> begin hello world", \Craft\LogLevel::Error);
@garyconstable
garyconstable / redactor_jquery_spell_checker.js
Created November 13, 2018 11:10
Redactor & JQuery Spell checker.
/***************************************************************************
Crazy Spell checker
/**************************************************************************/
(function($R){
$R.add('plugin', 'myplugin', {
init: function(app) {
this.app = app;
this.toolbar = app.toolbar;
@garyconstable
garyconstable / newsCron.php
Created November 8, 2018 14:39
Joomla Create News from app
<?php
class newsCron {
var $externalStart;
public function __construct($config) {
$news = $this->fetchNews();
if ($news) {
$this->storeNews($news, $config);
@garyconstable
garyconstable / gulpfile.js
Created November 8, 2018 08:24
Cache-bust Gulp File.
var gulp = require('gulp');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
var clean = require('gulp-clean');
var concat = require('gulp-concat');
var replace = require('gulp-replace');
var debug = require('gulp-debug');
@garyconstable
garyconstable / teamplate.php
Created August 30, 2018 16:24
Hacking Ajax load wp default template
<?php
$uri = $_SERVER['REQUEST_URI'];
if(preg_match('/repeater=team/', $uri, $matches)){ ?>
<?php $image = get_the_post_thumbnail_url( get_the_ID() , 'medium'); ?>
<div class="col-12 col-sm-6 col-md-3 team-repeater">
<div class="card news-card">
<a href="<?php the_permalink(); ?>">
<img class="card-img-top" src="<?php echo $image;?>" alt="Image for <?php echo get_the_title();?>">
<div class="card-body">
@garyconstable
garyconstable / shortcode.php
Created August 24, 2018 13:42
WP Plugin template
<?php
/*******************************************************************************
Activities Grid - Bakery Component
*******************************************************************************/
if(!function_exists('activitiesGridList_Bakery'))
{
if(!defined("THEME_TEXT_DOMAIN")){
define("THEME_TEXT_DOMAIN", "");
}
add_action( 'vc_before_init', 'activitiesGridList_Bakery' );
@garyconstable
garyconstable / port_scanner.php
Created August 16, 2018 14:48 — forked from akalongman/port_scanner.php
Port scanner on PHP
<?php
ini_set('max_execution_time', 0);
ini_set('memory_limit', -1);
$host = 'google.com';
$ports = array(21, 25, 80, 81, 110, 143, 443, 587, 2525, 3306);
foreach ($ports as $port)
{
$connection = @fsockopen($host, $port, $errno, $errstr, 2);
@garyconstable
garyconstable / install_php71.sh
Created July 19, 2018 10:55 — forked from wayanjimmy/install_php71.sh
Install php7.1 ubuntu 16.04 EC2
sudo apt-get update -y
sudo apt-get install -y nginx
sudo apt-get install -y python-software-properties
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update -y
sudo apt-get install -y php7.1 php7.1-fpm php7.1-cli php7.1-common php7.1-mbstring php7.1-gd php7.1-intl php7.1-xml php7.1-mysql php7.1-mcrypt php7.1-zip
sudo apt-get install php-curl