Skip to content

Instantly share code, notes, and snippets.

View VaLeXaR's full-sized avatar

Valentyn Riaboshtan VaLeXaR

View GitHub Profile
@VaLeXaR
VaLeXaR / class-wc-integration-demo-integration.php
Last active April 8, 2018 02:47 — forked from BFTrick/class-wc-integration-demo-integration.php
Додати нову інтеграцію WooCommerce #tags: WordPress, WooCommerce
<?php
/**
* Integration Demo Integration.
*
* @package WC_Integration_Demo_Integration
* @category Integration
* @author Patrick Rauland
*/
if ( ! class_exists( 'WC_Integration_Demo_Integration' ) ) :
@VaLeXaR
VaLeXaR / functions.php
Last active April 8, 2018 02:47
Fix http host port for Wordpress #tags: WordPress
<?php
add_action('init', function () {
if(!empty($_SERVER['HTTP_HOST']) && substr($_SERVER['HTTP_HOST'],-3)==':80')
$_SERVER['HTTP_HOST'] = substr($_SERVER['HTTP_HOST'],0,-3);
if(!empty($_SERVER['HTTP_X_FORWARDED_HOST']) && substr($_SERVER['HTTP_X_FORWARDED_HOST'],-3)==':80')
$_SERVER['HTTP_X_FORWARDED_HOST'] = substr($_SERVER['HTTP_X_FORWARDED_HOST'],0,-3);
}, 1);
@VaLeXaR
VaLeXaR / ajax-reg.js
Last active April 8, 2018 02:47 — forked from tommcfarlin/ajax-reg.js
Ajax реєстрація #tags: WordPress
/**
* This file is enqueued by means of wp_enqueue_script() - variables are passed
* in from PHP by means of wp_localize_script()
*
*/
/* TM: We use an anonymous function to invoke the JavaScript. Also refactored for proper
* WordPress coding standards.
*/
(function( $ ) {
@VaLeXaR
VaLeXaR / meta-data-serialization.php
Last active April 8, 2018 02:47 — forked from tommcfarlin/meta-data-serialization.php
Перевірка прав перед збереженням запису #tags: WordPress
<?php
/**
* An example function used to demonstrate how to use the `user_can_save` function
* that provides boilerplate security checks when saving custom post meta data.
*
* The ultimate goal is provide a simple helper function to be used in themes and
* plugins without the need to use a set of complex conditionals and constants.
*
* Instead, the aim is to have a simplified function that's easy to read and that uses
* WordPress APIs.
@VaLeXaR
VaLeXaR / index.html
Created April 4, 2017 06:47
Реєстрація через Фейсбук
<a class="fb_login_btn" onclick="fb_login();return false;"><img src="/image/fb_login.png" border="0" alt=""></a>
<script>
function handle_fb_data(response){
FB.api('/me', function(response) {
console.log('Successful login for: ' + response.name);
console.log('Прилитело из ФБ: '+JSON.stringify(response));
// alert('Прилитело из ФБ: '+JSON.stringify(response));
$.ajax({
@VaLeXaR
VaLeXaR / mb_similar_text.php
Created July 5, 2017 08:50 — forked from soderlind/mb_similar_text.php
Multibyte Similar Text for PHP, mb_similar_text()
<?php
/*
* solves the problem at http://stackoverflow.com/questions/31002690/how-to-use-similar-text-php-code-in-arabic, not that I know Arabic, but Norwegian also has multibyte charachters: æøåÆØÅ
*/
//from http://www.phperz.com/article/14/1029/31806.html
function mb_split_str($str) {
preg_match_all("/./u", $str, $arr);
return $arr[0];
}
@VaLeXaR
VaLeXaR / a_faster_load_textdomain.php
Created July 5, 2017 09:09 — forked from soderlind/a_faster_load_textdomain.php
A faster load_textdomain for WordPress
<?php
/*
Plugin Name: A faster load_textdomain
Version: 0.0.1
Description: While we're wating for https://core.trac.wordpress.org/ticket/32052.
Author: Per Soderlind
Author URI: https://soderlind.no
Plugin URI: https://gist.github.com/soderlind/610a9b24dbf95a678c3e
License: GPL
@VaLeXaR
VaLeXaR / not-so-super-admins.php
Created July 5, 2017 09:09 — forked from soderlind/not-so-super-admins.php
Control what (super) admins can do. Works with regular and multisite WordPress
<?php
/*
Plugin Name: Not So Super Admin
Plugin URI: https://gist.github.com/soderlind/8101b2e45e80b594e9c5
Description: Control what (super) admins can do
Author: Per Soderlind
Author URI: http://soderlind.no
Version: 0.0.6
License: GPL
Tags: multisite, admin
@VaLeXaR
VaLeXaR / SSL-certs-OSX.md
Created April 3, 2018 18:59 — forked from croxton/SSL-certs-OSX.md
Generate ssl certificates with Subject Alt Names

Generate ssl certificates with Subject Alt Names on OSX

Open ssl.conf in a text editor.

Edit the domain(s) listed under the [alt_names] section so that they match the local domain name you want to use for your project, e.g.

DNS.1   = my-project.dev

Additional FQDNs can be added if required:

@VaLeXaR
VaLeXaR / text.sh
Last active December 2, 2020 15:57
Angular Development #tags: Angular
NodeJS - https://nodejs.org/en/
# npm i webpack webpack-dev-server typescript -g
choco install nodejs.install
# choco upgrade nodejs.install
# choco install microsoft-build-tools
npm i windows-build-tools -g
npm i @angular/cli -g
npm i typescript -g
npm i nx -g