Skip to content

Instantly share code, notes, and snippets.

@sultann
sultann / github actions debug
Created October 12, 2021 13:29 — forked from ovitente/github actions debug
A way to debug Github Actions workflows
---
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/virtual-environments-for-github-hosted-runners
name : debug
on :
push :
branches : [ "master" ]
@sultann
sultann / functions.php
Created November 30, 2018 07:48 — forked from JiveDig/functions.php
Get the primary term of a post, by taxonomy. If Yoast Primary Term is used, return it, otherwise fallback to the first term.
<?php
/**
* Get the primary term of a post, by taxonomy.
* If Yoast Primary Term is used, return it,
* otherwise fallback to the first term.
*
* @version 1.1.0
*
* @link https://gist.github.com/JiveDig/5d1518f370b1605ae9c753f564b20b7f
@sultann
sultann / get-posts.sql
Last active October 14, 2018 04:52
WordPress posts with category & tags sql
select
p.id,
c.name as category,
GROUP_CONCAT(t.`name`) as tags
FROM wp_posts p
JOIN wp_term_relationships cr
on (p.`id`=cr.`object_id`)
JOIN wp_term_taxonomy ct
on (ct.`term_taxonomy_id`=cr.`term_taxonomy_id`
and ct.`taxonomy`='category')
@sultann
sultann / function.php
Created September 11, 2018 14:47
Change WordPress Howdy Admin texts
<?php
function prefix_replace_user_name(){
global $current_user;
$fname = $current_user->first_name;
$lname = $current_user->last_name;
$full_name = '';
if( empty($fname)){
$full_name = $lname;
} elseif( empty( $lname )){
@sultann
sultann / composer.json
Created April 9, 2018 04:33
Install WordPress plugin using composer without composer file in the repository
{
"type": "package",
"package": {
"name": "easydigitaldownloads/edd-free-downloads",
"version": "dev-master",
"type": "WordPress-plugin",
"source": {
"url": "git@github.com:easydigitaldownloads/edd-free-downloads.git",
"type": "git",
"reference": "master"
@sultann
sultann / Session.php
Created April 3, 2018 11:39 — forked from Nilpo/Session.php
A simple session wrapper class to provide static OOP access to PHP sessions.
<?php
/**
* Session Helper Class
*
* A simple session wrapper class.
*
* Recommended for use with PHP 5.4.0 or higher. (Not required.)
*
* Usage Example:
@sultann
sultann / custom.js
Created April 1, 2018 10:54
Gravity Forms – dynamic form reloading
<script type="text/javascript">
// let's make call to the global gwrf variable visible after enabling Gravity Forms
window.gwrf;
(function ($) {
gwrf = function (args) {
// prototype arguments, created when we instantiate it
this.formId = args.formId;
this.spinnerUrl = args.spinnerUrl;
@sultann
sultann / gist:ed68ff2eac9ec829e89003ed3daf5a56
Created February 19, 2018 04:48
Remove multiple database with a certain prefix?
SELECT CONCAT('DROP DATABASE `', SCHEMA_NAME, '`;')
FROM `information_schema`.`SCHEMATA`
WHERE SCHEMA_NAME LIKE 'demo%';
@sultann
sultann / ValetSwitchPHP.md
Created January 15, 2018 10:24 — forked from bgarrant/ValetSwitchPHP.md
How to Switch PHP Version in Laravel Valet between PHP 7.1 and PHP 5.6

Valet switch PHP version with these commands

Install PHP 5.6 and switch Valet to PHP 5.6

valet stop
brew unlink php71
brew install php56
brew install php56-mcrypt
brew link php56
valet start