Skip to content

Instantly share code, notes, and snippets.

View Mosharush's full-sized avatar
👨‍💻
Code. Sleep. Repeat.

Moshe Harush Mosharush

👨‍💻
Code. Sleep. Repeat.
View GitHub Profile
@Mosharush
Mosharush / 3d.css
Created January 4, 2019 01:10
Harlem Shake
html {
transform: translateZ(-107px);
transform-style: preserve-3d;
perspective: 532px;
}
body {
transform: translateZ(-94em) rotateX(30deg) rotateZ(-0deg);
}
@Mosharush
Mosharush / bookmark
Created December 25, 2018 23:19
Show input password test for auto fill password
javascript:const inputs=document.querySelectorAll('input[type=password]');inputs.forEach((input)=>{input.type='text';setTimeout(()=>{input.type='password';},5000);});
@Mosharush
Mosharush / find-out-admin-path.js
Last active November 30, 2018 23:05
Quick way to find out admin panel address
fetch('/robots.txt').then(function(data){
return data.text();
}).then(function(text) {
const paths = [
'?q=user',
'/wp-admin',
'/administrator',
'/cms',
'/admin',
];
@Mosharush
Mosharush / axios-middleware.js
Last active October 18, 2018 21:10
Nuxt.js 2.2.0 - Fix Error Cannot stringify arbitrary non-POJOs
/**
* plugins/axios-middleware.js
*/
import axios from 'axios';
axios.interceptors.response.use(response => {
if( typeof response.data === 'object' && response.data.constructor !== Array ) {
response.data = Object.assign({}, response.data);
}
@Mosharush
Mosharush / script.js
Last active December 27, 2017 03:16
Auto ajax function
$ = jQuery;
var ws_ajax_manager = function(){
// settings
this.config = {
content_selector: '.fl-page-content',
loader_src: 'https://loading.io/spinners/double-ring/lg.double-ring-spinner.gif',
};
@Mosharush
Mosharush / options_ui.php
Created December 7, 2017 06:41
HOTFIX - Rock Theme Wordpress, Azoom theme - Theme options not updates bug
<?php
function rockthemes_to_get_option_length( $array = array() ) {
if ( empty( $array ) ) {
return 0;
}
$array_count = 0;
@Mosharush
Mosharush / functions.php
Last active November 29, 2017 06:32
Fake Wordpress filter integartion for allow add page template via plugins
<?php
// Spacial Hook! : Add cart page template for cart on admin page options
add_filter( 'theme_page_templates', 'add_cart_page_template_option_select' );
add_filter( 'page_template', 'add_cart_page_template_to_theme', 10, 3 );
function add_cart_page_template_option_select( $post_templates ) {
$post_templates[ 'some-page-name-non-exist-or-uniqe.php' ] = __( 'Page Template Name', 'text-domain' );
return $post_templates;
}
function add_cart_page_template_to_theme( $template, $type, $templates ) {
if( $type === 'page' && $templates[0] === 'some-page-name-non-exist-or-uniqe.php' ) {
@Mosharush
Mosharush / makewp.php
Created October 30, 2017 13:02
Get latest Wordpress archive to server and extract files
<?php
// Function to remove folders and files
function rrmdir($dir) {
if (is_dir($dir)) {
$files = scandir($dir);
foreach ($files as $file)
if ($file != "." && $file != "..") rrmdir("$dir/$file");
rmdir($dir);
}
else if (file_exists($dir)) unlink($dir);
@Mosharush
Mosharush / functions.php
Last active September 27, 2017 11:47
Wipi (beaver) builder support for Contact Form 7 DB plugin
<?php
// Code start form here:
// Wipi (beaver) builder support for Contact Form 7 DB plugin
function webstorm_wipi_support_cf7db(){
// Save temp unnecessary post fields and remove untail save to db
$tempPost = $_POST;
unset( $_POST['fields'] );
unset( $_POST['action'] );
unset( $_POST['node_id'] );
@Mosharush
Mosharush / functions.php
Created September 27, 2017 10:48
WordPress PolyLang translate shortcode & function - use in customizer texts
<?php
// If Polylang is active, hook function on the admin pages
if ( function_exists( 'pll_register_string' ) ) add_action( 'admin_init', 'pll_tc_strings_setup' );
function pll_tc_strings_setup() {
// Add text to Polylang's string translation panel
pll_register_string( 'fl-topbar-col1-text', 'Contact_Data', 'wipi', true );
pll_register_string( 'fl-arrow-breadcrumbs', 'arrow_mulilang', 'wipi', true );
}
function polylanguage_shortcode( $atts ) {