Skip to content

Instantly share code, notes, and snippets.

View ediamin's full-sized avatar
:octocat:
Exploring

Edi Amin ediamin

:octocat:
Exploring
View GitHub Profile
@ediamin
ediamin / Mac Changer
Created December 1, 2013 09:55
Ubuntu Mac Changer with BASH script
#!/bin/bash
# usage: save this script as mac.sh in your home folder. open a teminal and give following command
# bash +x mac.sh
eth=`nmcli d | grep eth | awk '{print $1}'`
mac='YOUR_MAC_ADDRESS'
sudo ifconfig $eth hw ether $mac
sudo service network-manager restart
@ediamin
ediamin / cmb2-override.php
Last active August 29, 2015 14:23
How to change/update CMB2 field in child theme
<?php
/*****************************************************
==================PARENT THEME=========================
******************************************************/
/**
* Suppose this is the function that contains the cmb2 metaboxes
* in your parent theme. We want to change the name of the first
* metabox from "Banner Text" to "Banner Content" and then change it's
* type from "text" to "textarea"
@ediamin
ediamin / bootstrap-pagination.php
Created July 5, 2015 21:10
Bootstrap Pagination for WordPress
/*
* custom pagination with bootstrap .pagination class
* source: http://www.ordinarycoder.com/paginate_links-class-ul-li-bootstrap/
*/
function bootstrap_pagination( $echo = true ) {
global $wp_query;
$big = 999999999; // need an unlikely integer
$pages = paginate_links( array(
@ediamin
ediamin / woocommerce-custom-query.php
Last active January 26, 2018 01:20
WooCommerce Custom Query
<ul>
<?php
$args = array(
'post_type' => 'product',
'posts_per_page' => 3,
);
$query = new WP_Query( $args );
?>
@ediamin
ediamin / filter-search-result-post-link.php
Last active December 26, 2015 13:45
Filter Search Result Post Link
<?php
add_filter( 'post_link', 'filter_search_result_post_link', 10, 3 );
function filter_search_result_post_link( $permalink, $post, $leavename ) {
if ( is_search() && in_the_loop() ) {
$permalink = add_query_arg( 'ref', 'search', $permalink );
}
return $permalink;
}
@ediamin
ediamin / url-open-two-tabs.html
Last active February 25, 2016 09:43
On click open same url in two tabs
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="http://localhost/unique-dev/wp-includes/js/jquery/jquery.js?ver=1.11.3"></script>
</head>
<body>
<a href="http://google.com" target="_blank">Go to google</a>
@ediamin
ediamin / newton.zsh-theme
Created June 3, 2016 17:08
My zsh theme
# Customized version of Nt9 oh-my-zsh theme
# https://github.com/lenguyenthanh/nt9-oh-my-zsh-theme
# resources:
# html symbols: http://htmlarrows.com/
local ret_status="%{%F{blue}%}$USER@$HOST%{$reset_color%}"
local return_status="%{$fg[red]%}%(?..↵)%{$reset_color%} "
function _prompt_char() {
@ediamin
ediamin / wp-erp-extends.php
Created June 26, 2016 17:00
WP ERP - HRM: Custom employee types
<?php
/**
* Plugin Name: WP ERP Extends
* Description: Custom filters and hooks for WP ERP
*/
add_filter( 'erp_hr_employee_types', 'erp_hr_employee_types_custom_types' );
function erp_hr_employee_types_custom_types( $default_types ) {
$custom_types = [
'custom_type_1' => 'Custom Type 1',
@ediamin
ediamin / Sublime Text 3 Build 3103 License Key - CRACK
Created August 26, 2016 19:02
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
@ediamin
ediamin / snippets.cson
Last active September 13, 2016 16:22
Atom - Custom snippets
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#