Skip to content

Instantly share code, notes, and snippets.

@mtvbrianking
mtvbrianking / filter-on-return.js
Created Oct 31, 2020
jQuery filter on return
View filter-on-return.js
$.extend(true, $.fn.dataTable.defaults, {
initComplete: function(settings, json) {
var api = this.api();
var dtFilter = $.fn.dataTable.settings[0].aanFeatures.f;
var dtFilterInput = $('input', dtFilter);
dtFilterInput.unbind();
View laravel-routes.php
<?php
use Illuminate\Support\Facades\Route;
function matches($patterns, $subject)
{
if(! is_array($patterns)) {
return preg_match($patterns, $subject);
}
@mtvbrianking
mtvbrianking / vuejs-select-binding-2.vue
Last active Oct 19, 2020
vuejs select element binding
View vuejs-select-binding-2.vue
<template>
<div id="checkout">
<div class="row mt-3">
<slot></slot>
<div class="col-12 form-group">
<label class="text-small text-uppercase required" for="payment_gateway">Payment Method</label>
<select id="payment_gateway" name="payment_gateway" class="form-control"
v-on:change="chooseGateway($event)" v-model="selected">
<option v-for="_gateway in gateways"
v-bind:value="_gateway.value"
View jquery-single-vs-multiple-selection.html
<!DOCTYPE html>
<html>
<head>
<title>jQuery Single vs Multiple Selection</title>
<style>
.items {
padding: 0;
margin: 0;
list-style: none;
display: -webkit-box;
@mtvbrianking
mtvbrianking / array-of-objects-search.js
Created Oct 1, 2020
Javascript array of objects search
View array-of-objects-search.js
"use strict";
var users = [
{
id: 1,
alias: "jdoe",
name: "John Doe"
},
{
id: 2,
@mtvbrianking
mtvbrianking / index.html
Created Sep 29, 2020
JavaScript Windows and iFrames
View index.html
<!DOCTYPE html>
<html>
<head>
<title>Parent Window</title>
</head>
<body>
<label>Avatar</label>
<br/>
<input type="text" name="avatar" readonly>
<br/>
@mtvbrianking
mtvbrianking / build-nested-tree.php
Last active Oct 6, 2020
Build nested tree from flat array.
View build-nested-tree.php
<?php
$categories = [
['id' => 1, 'name' => 'TV & Home Theater', 'parent_id' => null,],
['id' => 2, 'name' => 'Tablets & E-Readers', 'parent_id' => null,],
['id' => 3, 'name' => 'Computers', 'parent_id' => null,],
['id' => 4, 'name' => 'Laptops', 'parent_id' => 3,],
['id' => 5, 'name' => 'PC Laptops', 'parent_id' => 4,],
['id' => 6, 'name' => 'Macbooks (Air/Pro)', 'parent_id' => 4,],
['id' => 7, 'name' => 'Desktops', 'parent_id' => 3,],
@mtvbrianking
mtvbrianking / dynamic-charts.js
Last active Jul 6, 2020
Create dynamic charts using ChartJS
View dynamic-charts.js
<!DOCTYPE html>
<html>
<head>
<title>Dynamic Charts</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container-fluid">
<div id="wrapper" class="row"></div>
</div>
@mtvbrianking
mtvbrianking / redis.md
Last active Jan 6, 2021
Install Redis on Xampp - Windows
View redis.md

Redis

Linux

jdoe@home-pc:~# apt-get install redis-server
jdoe@home-pc:~# systemctl enable redis-server@.service
jdoe@home-pc:~# apt-get update
jdoe@home-pc:~# apt-cache pkgnames | grep php7.4
jdoe@home-pc:~# apt install php7.4-redis
@mtvbrianking
mtvbrianking / gitlab-ci.yml
Created Mar 28, 2020
Gitlab pages deploy swagger docs
View gitlab-ci.yml
# https://gitlab.com/mbrian/ects-ea-docs/-/ci/lint
# This file is a template, and might need editing before it works on your project.
image: node:10-alpine
# specify the location of the Open API Specification files within your project
# and the filename of the specification that you would like to display by default
variables:
DOCS_FOLDER: "specs"
SPEC_TO_DISPLAY: "rects.yaml"