Skip to content

Instantly share code, notes, and snippets.

View MikhailRoot's full-sized avatar

Mikhail MikhailRoot

View GitHub Profile
@MikhailRoot
MikhailRoot / MyPluginUpdater.php
Created August 9, 2017 10:41
Example of how to use plugin-update-checker to check for updates multiple plugins and enable automatic background updates if needed.
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
require_once __DIR__. '/plugin-update-checker-4.2/plugin-update-checker.php';
class MyPluginUpdater {
const elixir = require('laravel-elixir');
elixir.extend('nghtml2js', function(sources,moduleName,prefix,destFolder,destfileName) {
const ngHtml2Js = require("gulp-ng-html2js");
const htmlmin = require('gulp-htmlmin');
const concat = require("gulp-concat");
const uglify = require("gulp-uglify");
new elixir.Task('nghtml2js',function(){
@MikhailRoot
MikhailRoot / toParam.js
Created October 29, 2016 13:54
AngularJS $http service tuning for Wordpress
/**
* Created by Mikhail.root on 22.02.2016. originaly from http://habrahabr.ru/post/181009/
* Fixed encoding of JS Date objects
*/
(function () {
'use strict';
angular.extend(angular, {toParam: toParam})
.module('YourAppModuleNameHere') // set it to your app module name!
.config(['$httpProvider',function ($httpProvider) {
$httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8';
// originaly based on code from https://css-tricks.com/findingfixing-unintended-body-overflow/
// improved to handle absolute positioned elements shifted to right making overflow happend.
function findOverflow(){
var docWidth = document.documentElement.offsetWidth;
[].forEach.call(
document.querySelectorAll('*'),
function(el) {
var rect= el.getBoundingClientRect();
if (el.offsetWidth > docWidth ||rect.right>docWidth) {