Skip to content

Instantly share code, notes, and snippets.

View klihelp's full-sized avatar
🎯
Focusing on life and money farm

klihelp

🎯
Focusing on life and money farm
View GitHub Profile
@klihelp
klihelp / load-js-from-innerhtml.js
Created January 12, 2017 21:22
Load JS files dynamically from innerHTML
/**
*
* @type is typescript
* @td use better logic for every content load
*/
var loadJsURL = function(url) {
var canJsLoad = function(url) {
if (!url) return false;
var scripts = document.getElementsByTagName('script');
@klihelp
klihelp / test_database_connect.php
Created September 23, 2016 14:12
Test script for database MySQL / MariaDB connection.
<?php
define('DB_HOST', 'localhost');
define('DB_NAME', 'XXX');
define('DB_USER', 'XXX');
define('DB_PASSWORD', 'XXX');
// Port : 3306
$messages = array(
'no_Host' => 'Unable to Connect to "'. DB_HOST.'".',
@klihelp
klihelp / kli-wp-api-remove-featured-image-field.php
Last active February 18, 2016 04:18
WP-API remove featured_image field

Regarding property ordering, I have to disagree that alphabetical is the sensible route. My ordering might seem strange, but the properties are grouped and ordered by relation to one another. Given the following example:

.element {
  box-sizing: content-box;
  color: blue;
  display: block;
  font-family: "Open Sans", sans-serif;
  font-size: 13px;
  font-style: italic;
@klihelp
klihelp / kli-js-elapsed-time.js
Last active September 18, 2015 07:00
Get elapsed time, time ago, supports timezone
/**
* Get elapsed time, time ago, supports timezone
* @param integer time --- string | unix timestamp
* @param strings --- string | array
* @return string elapsed time
*/
function(datetime, strings, elative_to) {
if (arguments.length) {
var datetime = typeof datetime !== 'string' ? datetime : new Date(datetime)
@klihelp
klihelp / kli - webapp - html css js - custom cursor.html
Last active August 29, 2015 14:13
Kli-WebApp - Custom Cursor with HTML/JS/CSS
<!--
// From Klihelp:
// https://gist.github.com/klihelp/67798dfc1266c3684326
//
// The idea is that
// - we hide the real cursor
// - and #custom_cursor div will follow the cursor, inside this div can have any text or image
-->
<?php /*
Plugin Name: Dynamic Image Resizer
Plugin URI: http://ottopress.com
Author: Otto42 / Modified by JochenT
Author URI: http://ottodestruct.com
Version: 1.0.0.1.jt-3 (11.10.2013)
Description: Change the WordPress image uploader system to do image resizing on the fly.
*/
/*
@klihelp
klihelp / kli-wp-prefix-posts-slugs.php
Last active August 29, 2015 13:57
WordPress - Prefix Custom Post Type posts slugs
<?php
/**
* Prefix Posts Slugs
* This hooks into wp_unique_post_slug and adds prefix to post slug. Eg: have post Hello title and slug will be my-prefix-hello.
* @author Klipolis
* @since 0.1.0
* @version 0.1.0
* @access public
* @main WordPress
*/
<?php
/*
Plugin Name: R Debug
Description: Set of dump helpers for debug.
Author: Andrey "Rarst" Savchenko
Author URI: http://www.rarst.net/
License: MIT
*/
/**