Skip to content

Instantly share code, notes, and snippets.

@Gkiokan
Gkiokan / FacebookProvider.php
Created Oct 23, 2020
FacebookProvider for Socialite October 2020
View FacebookProvider.php
<?php
/*
Author: Gkiokan Sali
Date: 2020-10-23
Comment: This is a working updated Facebook Provider for the Laraval Package Socialite.
It inherits the new changes on the User Image Endpoint and returns the new full User Image path
according to the new specs of fb with an access_token.
https://developers.facebook.com/docs/facebook-login/access-tokens#clienttokens
https://developers.facebook.com/docs/graph-api/reference/user/picture/
View GoogleGeocodingController.php
<?php
/*
Author: Gkiokan Sali
Web: https://gkiokan.net
Date: 11.08.2020
Comments:
Use Google Geocoding API in Laravel
but it can be extracted to any other PHP Application, too.
It has also helper functions that can help others, too.
*/
View util.js
/*
Author: Gkiokan Sali
Date: 02.01.2020
Notes: Utility for Vue JS functions, used as this.$util.{functionName}
*/
import Vue from 'vue'
import moment from 'moment'
@Gkiokan
Gkiokan / speech_prototype.js
Created Nov 14, 2019
WebKit Speech Recognition, playground with Google Chrome
View speech_prototype.js
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) {
@Gkiokan
Gkiokan / webpack.mix.js
Created Sep 25, 2019
Laravel Mix Webpack configuration alias and chunkFile configuration
View webpack.mix.js
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 / Token.php
Last active May 24, 2019
PHP Token Generator v2
View Token.php
<?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 / autoloadComponents.js
Created May 9, 2019
Autoload *.vue files as Component and register them
View autoloadComponents.js
/*
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$/)
View wp-cpt-custom-column.php
<?php
/*
File: WP Custom Columns Extension
Author: Gkiokan Sali
Date: 25.07.2018
*/
class CustomColumn {
@Gkiokan
Gkiokan / disable-rest-api.php
Last active Jul 25, 2018
WP Disable Rest API
View disable-rest-api.php
<?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 / add_admin_user_rescue.php
Created May 15, 2018
Add WP Admin User programmatically (rescue user)
View add_admin_user_rescue.php
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',