Skip to content

Instantly share code, notes, and snippets.

View itzikbenh's full-sized avatar

Isaac Ben Hutta itzikbenh

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

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 September 22, 2019 12:04
Vue Read More Component
<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 October 31, 2018 13:59 — forked from danyj/thz_disable_gutenberg.php
Disable Gutenberg globally or for specific post types for WordPress 5.0 and UP
<?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 August 22, 2018 02:34
WP - update user and keeps him login with ability to make more requests without page refresh.
<?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 June 19, 2018 22:39
fresh block
license: mit
<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"
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
@itzikbenh
itzikbenh / Datatables.vue
Last active January 13, 2018 19:21
Vue datatables
<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 January 2, 2018 18:37 — forked from wesbos/async-await.js
Simple Async/Await Example
// 🔥 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
});
}
@itzikbenh
itzikbenh / PrintTable.vue
Created December 10, 2017 16:34
Print table
<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>