Skip to content

Instantly share code, notes, and snippets.

@Gkiokan
Gkiokan / .git-bash-upgrade
Created November 20, 2016 12:38
Git Bash Upgrade the prompt like the agnoster Theme.
if test -f /etc/profile.d/git-sdk.sh
then
TITLEPREFIX=SDK-${MSYSTEM#MINGW}
else
TITLEPREFIX=$MSYSTEM
fi
PS1='\[\033]0;$TITLEPREFIX:${PWD//[^[:ascii:]]/?}\007\]' # set window title
PS1="$PS1"'\n' # new line
@Gkiokan
Gkiokan / Gruntfile.js
Created December 12, 2016 00:25
A basic grunt Configuration to start
/*
File: Gruntfile.js
Author: Gkiokan Sali
Date: 2.12.2016
Comments: Grunfile.js Configuration for new Projects
usage:
I've prepared a nicely structure for running with grunt.
All your source development files will be in assets/src.
Beneath that you split up your code in /js and /sass folders.
By default as the code is, javascript and css will be compiled to
@Gkiokan
Gkiokan / Delete BOM from json
Created December 15, 2016 19:53
Delete BOM in a json content
$content = file_get_contents($cc_uri);
$content = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $content);
$content = json_decode($content,true);
@Gkiokan
Gkiokan / WP-error-handling.php
Last active January 2, 2017 09:03
WP Error Handling on Plugins
/*
GistName: WP Error Handling
Author: Gkiokan Sali
Url: www.gkiokan.net
Description:
Use this for debugging activision errors.
Create a error_activation.txt error log in the spezific plugin directory.
*/
if(WP_DEBUG)
@Gkiokan
Gkiokan / restore_file_permission.sh
Created January 27, 2017 12:03
Operation not Permitted after in .git Objects
# Run this in the .git/objects folder to set the permissions
# even they are flagged as immutable
sudo chflags -R nouchg *
sudo own -R $USER *
echo " > Persmissions have been set ."
@Gkiokan
Gkiokan / wp-sc-helper-btn-example.php
Created January 30, 2017 09:23
WP Shortcode Helper Class
<?php
/*
File: Button Controller
Date: today
Author: Gkiokan
Comment: A Shortcode Class Helper with VC integration
*/
if( ! defined( 'ABSPATH' ) ) exit;
@Gkiokan
Gkiokan / wp-fix-svg-uploads.php
Created February 6, 2017 14:30
WP 4.7.1+ SVG Broken Upload errors
<?php
/*
SVG fix for 4.7.1+
*/
add_filter( 'wp_check_filetype_and_ext', function($filetype_ext_data, $file, $filename, $mimes) {
if ( substr($filename, -4) === '.svg' ) {
$filetype_ext_data['ext'] = 'svg';
$filetype_ext_data['type'] = 'image/svg+xml';
}
@Gkiokan
Gkiokan / PostColumnExtension
Last active March 13, 2017 11:13
Add Custom Columns to WP Admin List
/*
Snipped: Create Custom Post Extension
Author: Gkiokan Sali
Author URL: https://www.gkiokan.net
Date: 13.03.2017
Tested on WP: 4.7.3
License: MIT
Description: Extend your Admin List Table by custom columns in a easy way.
Just call the Class in your Plugin with PostcolumnExtension($YourPostType) and you are fine to go.
The Plugin will hook into the manage_*_posts_columns and will render the specified Column Content,
@Gkiokan
Gkiokan / wp-fix-svg-in-media-preview.php
Created April 5, 2017 12:02
WP recognize the SVG as Image in Previews
<?php
/**
* File: This enables you svg support fot the media preview in WP.
*
***/
function common_svg_media_thumbnails($response, $attachment, $meta){
if($response['type'] === 'image' && $response['subtype'] === 'svg+xml' && class_exists('SimpleXMLElement'))
{
@Gkiokan
Gkiokan / wp-request-helper.php
Created April 12, 2017 13:59
WP Remote Helper
<?php
/*
Author: Gkiokan
Date: 12.04.2017
URI: www.gkiokan.net
Comment: Helps to send easy wp_remote_get/_post
*/
class WP_Remote_Helper {