Skip to content

Instantly share code, notes, and snippets.

Avatar

Mikhail MikhailRoot

View GitHub Profile
@MikhailRoot
MikhailRoot / MyPluginUpdater.php
Created Aug 9, 2017
Example of how to use plugin-update-checker to check for updates multiple plugins and enable automatic background updates if needed.
View MyPluginUpdater.php
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
require_once __DIR__. '/plugin-update-checker-4.2/plugin-update-checker.php';
class MyPluginUpdater {
View laravel-5.3-elixir-nghtml2js-extension.js
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 Oct 29, 2016
AngularJS $http service tuning for Wordpress
View toParam.js
/**
* 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';
View find-overflow-elements.js
// 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) {
You can’t perform that action at this time.