Skip to content

Instantly share code, notes, and snippets.

View fazlurr's full-sized avatar

Fazlur Rahman fazlurr

View GitHub Profile
// Version 4.0
const pSBC=(p,c0,c1,l)=>{
let r,g,b,P,f,t,h,i=parseInt,m=Math.round,a=typeof(c1)=="string";
if(typeof(p)!="number"||p<-1||p>1||typeof(c0)!="string"||(c0[0]!='r'&&c0[0]!='#')||(c1&&!a))return null;
if(!this.pSBCr)this.pSBCr=(d)=>{
let n=d.length,x={};
if(n>9){
[r,g,b,a]=d=d.split(","),n=d.length;
if(n<3||n>4)return null;
x.r=i(r[3]=="a"?r.slice(5):r.slice(4)),x.g=i(g),x.b=i(b),x.a=a?parseFloat(a):-1
@fazlurr
fazlurr / ContentEditor.vue
Last active November 19, 2019 05:39
Vue WYSIWYG Editor using tip-tap library
<template>
<!-- WYSIWYG Editor -->
<div class="editor mb-4">
<editor-menu-bar class="editor-bar" :editor="editor">
<div slot-scope="{ commands, isActive, focused }">
<!-- Bold -->
<button
type="button"
class="btn btn-plain"
:class="{ 'is-active': isActive.bold() }"
/**
* Get Color Contrast
* @param {string} hex Hexa Color Code
*/
export const getColorContrast = (hex) => {
const color = hexToRgb(hex);
const treshold = 186;
const contrast = color
&& (color.r * 0.299 + color.g * 0.587 + color.b * 0.114) > treshold ? 'black' : 'white';
// for (const key in color) {
<?php
return [
// ...
'debug_blacklist' => [
'_ENV' => [
'APP_KEY',
'DB_PASSWORD',
<draggable
v-model="product.images"
v-bind="dragOptions"
@start="drag = true"
@end="drag = false">
<transition-group
class="row small-gutter"
type="transition"
:name="!drag ? 'flip-list' : null">
<div class="col" v-for="(image, index) in product.images" :key="index + 0">
sudo netstat -nputwc
file=
region=ap-southeast-1
bucket=
resource="/${bucket}/${file}"
contentType="application/zip"
dateValue=`date -R`
stringToSign="PUT\n\n${contentType}\n${dateValue}\n${resource}"
s3Key=
s3Secret=
signature=`echo -en ${stringToSign} | openssl sha1 -hmac ${s3Secret} -binary | base64`
date -d "yesterday 13:00" '+%Y-%m-%d'
echo $(date -d "yesterday 13:00" +%Y_%m_%d)
.header-main {
border-bottom: 1px solid #ebebeb;
}
.header-main.sticky-header {
border-bottom-color: transparent;
}
.header-v2 .navbar-nav > li > a:before {
bottom: -1px;
<?php
/**
* @param string $url
* @see https://stackoverflow.com/a/51246730/5627904
*/
function get_youtube_id($url) {
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored)
// http://youtu.be/dQw4w9WgXcQ
// http://www.youtube.com/embed/dQw4w9WgXcQ
// http://www.youtube.com/watch?v=dQw4w9WgXcQ