Skip to content

Instantly share code, notes, and snippets.

View akshuvo's full-sized avatar

Akhtarujjaman Shuvo akshuvo

View GitHub Profile
@akshuvo
akshuvo / download-file-by-url.php
Created October 18, 2022 20:17 — forked from maheshwaghmare/download-file-by-url.php
Download file by URL and move in uploads directory
<?php
/**
* Download File In Uploads Directory
*
* Eg.
*
* $file = download_file( `file-url` );
*
* if( $file['success'] ) {
* $file_abs_url = $file['data']['file'];

Disclaimer: I'm not the original author of this sheet, but can't recall where I found it. If you know the author, please let me know so I give the attribution.

Note: Since this seems to be helpful to some people, I formatted it to improve readability of the original. Also, note that this is from 2016, many things may have changed, and I don't use macOS anymore, so I probably can't help in case of questions, but maybe someone else can.

Mac Network Commands Cheat Sheet

After writing up the presentation for MacSysAdmin in Sweden, I decided to go ahead and throw these into a quick cheat sheet for anyone who’d like to have them all in one place. Good luck out there, and stay salty.

Get an ip address for en0:

@akshuvo
akshuvo / functions.php
Created October 5, 2020 23:12 — forked from riotxoa/functions.php
WooCommerce Coupons Fix: email restrictions
/*
WooCommerce email restriction for coupons does not work. This fix corrects it.
Include this code snippet in your theme or plugin.
*/
add_filter( 'woocommerce_coupon_is_valid', 'wc_riotxoa_coupon_is_valid', 10, 2 );
if ( ! function_exists( 'wc_riotxoa_coupon_is_valid' ) ) {
function wc_riotxoa_coupon_is_valid( $result, $coupon ) {
<?php
/*
This script will allow you to send a custom email from anywhere within wordpress
but using the woocommerce template so that your emails look the same.
Created by craig@123marbella.com on 27th of July 2017
Put the script below into a function or anywhere you want to send a custom email
*/
/* Add custom menu item and endpoint to WooCommerce My-Account page */
function my_custom_endpoints() {
add_rewrite_endpoint( 'refunds-returns', EP_ROOT | EP_PAGES );
}
add_action( 'init', 'my_custom_endpoints' );
// so you can use is_wc_endpoint_url( 'refunds-returns' )
add_filter( 'woocommerce_get_query_vars', 'my_custom_woocommerce_query_vars', 0 );
@akshuvo
akshuvo / gist:3e7ef64919e80b2029e6ce4a6e05251e
Created April 16, 2020 17:47 — forked from ivandoric/gist:e4e46294c4d35eac0ec8
wordpress: create custom reset password page
<?php //Add all of this tu custom page template ?>
<?php
global $wpdb;
$error = '';
$success = '';
// check if we're in reset form
if( isset( $_POST['action'] ) && 'reset' == $_POST['action'] )
{
@akshuvo
akshuvo / gulpfile.js
Created March 10, 2020 11:20 — forked from leymannx/gulpfile.js
Gulp 4 Sass BrowserSync Kickstart Example
// Requires Gulp v4.
// $ npm uninstall --global gulp gulp-cli
// $ rm /usr/local/share/man/man1/gulp.1
// $ npm install --global gulp-cli
// $ npm install
const { src, dest, watch, series, parallel } = require('gulp');
const browsersync = require('browser-sync').create();
const sass = require('gulp-sass');
const autoprefixer = require('gulp-autoprefixer');
const sourcemaps = require('gulp-sourcemaps');
@akshuvo
akshuvo / woocommerce-settings-tab-demo.php
Created February 25, 2020 22:11 — forked from BFTrick/woocommerce-settings-tab-demo.php
A plugin demonstrating how to add a WooCommerce settings tab.
<?php
/**
* Plugin Name: WooCommerce Settings Tab Demo
* Plugin URI: https://gist.github.com/BFTrick/b5e3afa6f4f83ba2e54a
* Description: A plugin demonstrating how to add a WooCommerce settings tab.
* Author: Patrick Rauland
* Author URI: http://speakinginbytes.com/
* Version: 1.0
*
* This program is free software: you can redistribute it and/or modify
@akshuvo
akshuvo / functions.php
Created February 23, 2020 04:30 — forked from EddyRespondek/functions.php
Wordpress - Simple AJAX Pagination
function get_posts_for_pagination() {
$html = '';
$paged = ( $_GET['page'] ) ? $_GET['page'] : 1;
$post_type = $_GET['posttype'];
if ( empty($post_type) ) {
return '';
}
if( filter_var( intval( $paged ), FILTER_VALIDATE_INT ) ) {
@akshuvo
akshuvo / hide-editor.php
Created January 6, 2020 09:17 — forked from ramseyp/hide-editor.php
Hide the content editor for certain pages in WordPress
<?php
/**
* Hide editor on specific pages.
*
*/
add_action( 'admin_init', 'hide_editor' );
function hide_editor() {
// Get the Post ID.