Skip to content

Instantly share code, notes, and snippets.

@MervinPraison
MervinPraison / gist:e15aa6b8bed77bd2d3eea34dfd3b84e9
Created July 25, 2017 08:28 — forked from wrburgess/gist:3711050
Permanently remove file from Git history

Reference

Remove sensitive files from Git/Github

In Terminal

git filter-branch --index-filter 'git rm --cached --ignore-unmatch [file path/name]' --prune-empty --tag-name-filter cat -- --all

Example:

@MervinPraison
MervinPraison / whatissoslow.php
Created July 25, 2017 08:29 — forked from Viper007Bond/whatissoslow.php
WordPress: Times how long it takes each filter and action to run and displays results at the end of the page. Quick and dirty.
<?php
/**
* This little class records how long it takes each WordPress action or filter
* to execute which gives a good indicator of what hooks are being slow.
* You can then debug those hooks to see what hooked functions are causing problems.
*
* This class does NOT time the core WordPress code that is being run between hooks.
* You could use similar code to this that doesn't have an end processor to do that.
*
@MervinPraison
MervinPraison / custom-http-requests-timeout.php
Last active September 6, 2017 11:41 — forked from samuelaguilera/custom-http-requests-timeout.php
cURL error 28: Operation timed out error
<?php
// NOTE: THE CODE TO COPY/PASTE STARTS *BELOW* THIS LINE
// Setting a custom timeout value for cURL.
//Using a high value for priority to ensure the function runs after any other added to the same action hook.
add_action('http_api_curl', 'sar_custom_curl_timeout', 9999, 1);
function sar_custom_curl_timeout( $handle ){
curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, 30 ); // 30 seconds. Too much for production, only for testing.
curl_setopt( $handle, CURLOPT_TIMEOUT, 30 ); // 30 seconds. Too much for production, only for testing.
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MervinPraison
MervinPraison / PHP Sort by Scripture (Bible)
Created June 19, 2018 09:55 — forked from dajare/PHP Sort by Scripture (Bible)
Comp function to sort PHP Array by Bible Verses (Scripture Books)
function scripturesort($a, $b) {
if ($a == $b) {return 0;}
$order=array("Genesis", "Exodus", "Leviticus", "Numbers", "Deuteronomy", "Joshua", "Judges", "Ruth", "1 Samuel", "2 Samuel", "1 Kings", "2 Kings", "1 Chronicles", "2 Chronicles", "Ezra", "Nehemiah", "Esther", "Job", "Psalm", "Proverbs", "Ecclesiastes", "Song of Solomon", "Isaiah", "Jeremiah", "Lamentations", "Ezekiel", "Daniel", "Hosea", "Joel", "Amos", "Obadiah", "Jonah", "Micah", "Nahum", "Habakkuk", "Zephaniah", "Haggai", "Zechariah", "Malachi", "Matthew", "Mark", "Luke", "John", "Acts", "Romans", "1 Corinthians", "2 Corinthians", "Galatians", "Ephesians", "Philippians", "Colossians", "1 Thessalonians", "2 Thessalonians", "1 Timothy", "2 Timothy", "Titus", "Philemon", "Hebrews", "James", "1 Peter", "2 Peter", "1 John", "2 John", "3 John", "Jude", "Revelation");
$fa = $a;
$fb = $b;
preg_match('/^..(.+?)\b/', $a, $matches);
$a = trim(substr($matches[0],0,4));
@MervinPraison
MervinPraison / custom-post-taxonomy-permalinks.php
Created June 30, 2018 06:28 — forked from kasparsd/custom-post-taxonomy-permalinks.php
Create permalink structure URLs for custom post types that include all parent terms from a custom taxonomy
<?php
/*
Term Archive Pages:
- http://example.com/recipes/dinner/
- http://example.com/recipes/breakfast,brunch/
Single Recipe Pages:
- http://example.com/recipes/dinner/soup-title/
@MervinPraison
MervinPraison / WordPress Custom Global Variables.md
Created July 18, 2018 10:17 — forked from aahan/WordPress Custom Global Variables.md
Creating and using custom global variables in wordpress.

First create global variables (in functions.php or as a mu-plugin):

<?php

/*
 * CUSTOM GLOBAL VARIABLES
 */
function wtnerd_global_vars() {
@MervinPraison
MervinPraison / AIA003_tf_estimators.ipynb
Created June 20, 2019 10:44 — forked from yufengg/AIA003_tf_estimators.ipynb
Jupyter notebook for AI Adventures episode 3
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MervinPraison
MervinPraison / .dockerignore
Created January 29, 2021 00:28 — forked from ekandreas/.dockerignore
Dockerize your WordPress Bedrock
*
!docker.conf