Skip to content

Instantly share code, notes, and snippets.

Avatar

Isaac Ben Hutta itzikbenh

View GitHub Profile
@itzikbenh
itzikbenh / rm_mysql.md
Created Dec 20, 2019 — forked from vitorbritto/rm_mysql.md
Remove MySQL completely from Mac OSX
View rm_mysql.md

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

    brew remove mysql
    
@itzikbenh
itzikbenh / ReadMore.vue
Last active Sep 22, 2019
Vue Read More Component
View ReadMore.vue
<template>
<div v-if="text">
<div v-html="formattedText"></div>
<span v-if="text.length > maxChars">
<a href="#" v-if="!isReadMore" @click.prevent="triggerReadMore()">{{ readMoreText }}</a>
<a href="#" v-if="isReadMore && readLessText" @click.prevent="triggerReadLess()">{{ readLessText }}</a>
</span>
</div>
</template>
@itzikbenh
itzikbenh / thz_disable_gutenberg.php
Created Oct 31, 2018 — forked from danyj/thz_disable_gutenberg.php
Disable Gutenberg globally or for specific post types for WordPress 5.0 and UP
View thz_disable_gutenberg.php
<?php
/*
* Disable Gutenberg globally
* use this if you prefer one-liner
* add_filter('use_block_editor_for_post', '__return_false');
*/
function _thz_filter_disable_block_editor(){
return false;
}
add_filter( 'use_block_editor_for_post', '_thz_filter_disable_block_editor' );
@itzikbenh
itzikbenh / functions.php
Created Aug 22, 2018
WP - update user and keeps him login with ability to make more requests without page refresh.
View functions.php
<?php
function my_update_cookie( $logged_in_cookie ) {
$_COOKIE[ LOGGED_IN_COOKIE ] = $logged_in_cookie;
}
add_action( 'set_logged_in_cookie', 'my_update_cookie' );
wp_localize_script(
'theme_js',
'theme_data',
@itzikbenh
itzikbenh / .block
Last active Jun 19, 2018
fresh block
View .block
license: mit
View lightbox.vue
<template>
<div>
<a href="#" @click.prevent="show" class="w-full">
<img class="w-64" :src="thumbnail">
</a>
<div class="lightbox fixed pin z-50 flex justify-center items-center" v-if="visible" @click="hide">
<div class="fixed pin-r pin-t text-white cursor-pointer text-4xl p-1 mr-2" @click.stop="hide">&times;</div>
<div class="flex">
<div class="cursor-pointer self-center px-8"
@click.stop="prev"
View gist:79a6c6e8bc4d2a2fb84f21fcbb532764
WordPress + NGINX
- sudo apt-get update
- sudo add-apt-repository -y ppa:nginx/development
- sudo add-apt-repository -y ppa:ondrej/php
- sudo apt-get update
- sudo apt-get install -y git tmux vim curl wget zip unzip htop
- sudo apt-get install -y nginx
- sudo systemctl start nginx
- sudo systemctl enable nginx
View Datatables.vue
<style>
thead {
.sorting {
background-image: url('DataTables-1.10.15/images/sort_both.png');
background-repeat: no-repeat;
background-position: center right;
}
.sorting_asc {
background-image: url('DataTables-1.10.15/images/sort_asc.png');
background-repeat: no-repeat;
@itzikbenh
itzikbenh / async-await.js
Created Jan 2, 2018 — forked from wesbos/async-await.js
Simple Async/Await Example
View async-await.js
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
View PrintTable.vue
<template>
<a class="button" @click.stop="printTable">
<span class="icon is-small">
<i class="fa fa-print export-button table-export-print" aria-hidden="true"
title="Print"></i>
</span>
</a>
</template>
<script>