Skip to content

Instantly share code, notes, and snippets.

@haipham
haipham / autorun.js
Created November 22, 2017 15:48 — forked from anteriovieira/autorun.js
VueJs
var subscribers = []
var activeJob = null
var a = 3
var state = {
get a () {
if(subscribers.indexOf(activeJob) < 0){
subscribers.push(activeJob)
}
return a
@haipham
haipham / remove-export-links.php
Created February 4, 2018 18:29 — forked from andrasguseo/remove-export-links.php
Remove export links from The Events Calendar
@haipham
haipham / custom-nav-walker-usage.php
Created February 9, 2018 12:54 — forked from kosinix/custom-nav-walker-usage.php
WordPress: Using a custom nav walker to create navigation menus in plain <a> tags. That is the <ul> and <li> tags are not present. Very useful if you want to create simple links that can be centered with a simple text-align:center on the containing element.
<?php
// In your template files like footer.php
// The items_wrap value ('%3$s') removes the wrapping <ul>, while the custom walker (Nav_Footer_Walker) removes the <li>'s.
wp_nav_menu(array('items_wrap'=> '%3$s', 'walker' => new Nav_Footer_Walker(), 'container'=>false, 'menu_class' => '', 'theme_location'=>'footer', 'fallback_cb'=>false ));
?>
<?php
/*
* WordPress Breadcrumbs
* author: Dimox
* version: 2017.21.01
* license: MIT
*/
function dimox_breadcrumbs() {
/* === OPTIONS === */
@haipham
haipham / bosco_archive.php
Created December 26, 2019 22:08 — forked from pommiegranit/bosco_archive.php
WordPress theme changes when adding category featured images
<?php
/**
* @package Bosco
*/
if ( is_category() && function_exists('category_image_src')) {
$category_image = category_image_src( array( 'size' => 'full' ) , false );
} else {
$category_image = '';
}
@haipham
haipham / index.js
Created June 30, 2020 18:54 — forked from jinseokoh/index.js
laravel-vue-spa-blog-03
import Vue from 'vue'
import store from '~/store'
import Meta from 'vue-meta'
import routes from './routes'
import Router from 'vue-router'
import { sync } from 'vuex-router-sync'
Vue.use(Meta)
Vue.use(Router)
@haipham
haipham / dom_performance_reflow_repaint.md
Created August 11, 2020 17:05 — forked from faressoft/dom_performance_reflow_repaint.md
DOM Performance (Reflow & Repaint) (Summary)

DOM Performance

Rendering

  • How the browser renders the document
    • Receives the data (bytes) from the server.
    • Parses and converts into tokens (<, TagName, Attribute, AttributeValue, >).
    • Turns tokens into nodes.
    • Turns nodes into the DOM tree.
  • Builds CSSOM tree from the css rules.
@haipham
haipham / README.md
Created September 9, 2020 12:14 — forked from tombigel/README.md
How to Change Open Files Limit on OS X and macOS Sierra (10.8 - 10.12)

How to Change Open Files Limit on OS X and macOS

This text is the section about OS X Yosemite (which also works for macOS Sierra) from https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/#mac-os-x

The last time i visited this link it was dead (403), so I cloned it here from the latest snapshot in Archive.org's Wayback Machine https://web.archive.org/web/20170523131633/https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/

Mac OS X

To check the current limits on your Mac OS X system, run:

@haipham
haipham / mysql2sqlite.sh
Created November 10, 2020 14:10 — forked from esperlu/mysql2sqlite.sh
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@haipham
haipham / jquery-datepicker-wp-admin
Created January 29, 2021 21:51 — forked from slushman/jquery-datepicker-wp-admin
How to Add the jQuery UI Datepicker to the WordPress Admin
/**
* Adds the datepicker settings to the admin footer.
* Only loads on the plugin-name settings page
*/
function admin_footer() {
$screen = get_current_screen();
if ( $screen->id == 'settings_page_plugin-name' ) {