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 / 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 / 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
@sultann
sultann / wp-auto-login-single-user.php
Created June 19, 2017 18:57 — forked from cliffordp/functions.php
Automatically login a single WordPress user upon arrival to a specific page. Redirect to home page once logged in. Prevent viewing the login page. Tested with WP 3.9.1. Used in functions.php
<?php
//Automatically login a single WordPress user upon arrival to a specific page.
//Redirect to home page once logged in and prevent viewing of the login page.
//Tested with WP 3.9.1. Used in functions.php
//Updated 2014-07-18 to resolve WP_DEBUG notice: "get_userdatabylogin is deprecated since version 3.3! Use get_user_by('login') instead."
//From http://tourkick.com/2014/wordpress-demo-multisite-db-reset/
function auto_login() {
//change these 2 items
$loginpageid = '1234'; //Page ID of your login page

MAMP PRO 4 Trial Reset

A simple script that resets latest MAMP PRO 4 trial validity, and keeps your data safe.

How to use

  • Copy the code into a file OR download the script and save it as reset_mamp4.sh
  • Open the Terminal app and write chmod +x then drag and drop the file on the Terminal. You should have something like chmod +x reset_mamp4.sh. Press Enter to run it.
  • Now, run the file itself by dragging and dropping it on the Terminal (something like reset_mamp4.sh) then pressing Enter.
  • Open MAMP PRO and check if you have 14 days left now.

Didn't work?

@sultann
sultann / ld-auto-mark-complete.php
Created November 4, 2016 17:13
Learn Dash - Auto Mark Complete
function ld_is_topic($postId) {
$tags = wp_get_post_tags($postId);
foreach ($tags as $tag) {
if ($tag->name === 'auto-mark-complete') {
return true;
}
}
return false;
}
@sultann
sultann / 0_reuse_code.js
Created September 29, 2016 04:51
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@sultann
sultann / Sublime Text 3 Build 3103 License Key - CRACK
Created May 29, 2016 04:55
Sublime Text 3 Build 3103 License Key - CRACK
I use the first
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
@sultann
sultann / wordpress-change-url.php
Created December 2, 2015 20:21 — forked from lavoiesl/wordpress-change-url.php
PHP script to replace site url in Wordpress database dump, even with WPML
#!/usr/bin/env php
<?php
/**
* PHP script to replace site url in Wordpress database dump, even with WPML
* @link https://gist.github.com/lavoiesl/2227920
*/
if (!empty($argv[1]) && $argv[1] == 'update') {
$file = file_get_contents('https://gist.github.com/lavoiesl/2227920/raw/wordpress-change-url.php');
if ($file === false) {