Skip to content

Instantly share code, notes, and snippets.

Fazlur Rahman fazlurr

Block or report user

Report or block fazlurr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View psbc.js
// 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 Nov 19, 2019
Vue WYSIWYG Editor using tip-tap library
View ContentEditor.vue
<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() }"
View contrast.js
/**
* 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) {
View app.php
<?php
return [
// ...
'debug_blacklist' => [
'_ENV' => [
'APP_KEY',
'DB_PASSWORD',
View draggable.vue
<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">
View s3-upload.sh
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`
View date.bash
date -d "yesterday 13:00" '+%Y-%m-%d'
echo $(date -d "yesterday 13:00" +%Y_%m_%d)
View custom.css
.header-main {
border-bottom: 1px solid #ebebeb;
}
.header-main.sticky-header {
border-bottom-color: transparent;
}
.header-v2 .navbar-nav > li > a:before {
bottom: -1px;
View getYouTubeId.php
<?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
You can’t perform that action at this time.