Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing on life and money farm

klihelp

🎯
Focusing on life and money farm
View GitHub Profile
View docker-pause-toggle.sh
# Toggle paused status for running containers
if [[ $(docker ps -q -f status=paused | wc -l) -gt 0 ]]; then docker unpause $(docker ps -q -f status=paused); else docker pause $(docker ps -q -f status=running); fi;
View fill_space_up.dev.js
/**
* Fill Space Up
* ver 0.1.0
*
* Repeater to fillup remaining screen space in the line.
* @TD Make it work for row and column, initial alignment of horizontally or vertically
* @TD Make calculations with js, without wrapping elements into div
*
@klihelp
klihelp / kli_gutenberg_gallery_fix.php
Created Mar 20, 2018
Replace Gutenberg gallery block with the gallery shortcode.
View kli_gutenberg_gallery_fix.php
@klihelp
klihelp / log.js
Created Nov 23, 2017
Log Function JS
View log.js
/**
* Log Function in es6
*/
function log() {
var line = Array.prototype.slice
.call(arguments)
.map(function(argument) {
return typeof argument === 'string' ? argument : JSON.stringify(argument);
})
.join(' ');
View publish packages to NPM.md

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "you@example.com"
npm set init.author.url "http://yourblog.com"

npm adduser
@klihelp
klihelp / app.module.ts
Last active Mar 24, 2021
Angular 2 - Add safeHtml for innerHTML
View app.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { SafeHtmlPipe } from "./pipes"
@NgModule({
declarations: [
SafeHtmlPipe,
@klihelp
klihelp / app.module.ts
Last active May 14, 2018
Angular 2 - Add safeHtml with loading scripts from innerHTML
View app.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import { CheckScriptsPipe, SafeHtmlPipe } from "./pipe.safehtml.loadJsURL.ts"
@NgModule({
declarations: [
@klihelp
klihelp / load-js-from-innerhtml.js
Created Jan 12, 2017
Load JS files dynamically from innerHTML
View load-js-from-innerhtml.js
/**
*
* @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 Sep 23, 2016
Test script for database MySQL / MariaDB connection.
View test_database_connect.php
<?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.'".',
View Property Order.md

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;