Skip to content

Instantly share code, notes, and snippets.

View fazlurr's full-sized avatar

Fazlur Rahman fazlurr

View GitHub Profile
@fazlurr
fazlurr / read-excel.php
Created September 30, 2022 07:23
Read Excel in PHP
<?php
use Shuchkin\SimpleXLSX;
...
$file = $request->file('file');
$file_path = $file->getRealPath();
if ( $xlsx = SimpleXLSX::parse($file_path) ) {
$rows = $xlsx->rows();
// Degrees to Radians
export const degsToRads = deg => (deg * Math.PI) / 180.0;
// Radians to Degrees
export const radsToDegs = rad => rad * 180 / Math.PI;
// Round like PHP Function
export const round = (num, dec) => {
var num_sign = num >= 0 ? 1 : -1;
return parseFloat((Math.round((num * Math.pow(10, dec)) + (num_sign * 0.0001)) / Math.pow(10, dec)).toFixed(dec));
@fazlurr
fazlurr / API Contract Example Spec.md
Created June 7, 2022 03:13 — forked from BeattieM/API Contract Example Spec.md
An example of an API contract between the server and front-end devices

#Users

  • User object
{
  id: integer
  username: string
  email: string
  created_at: datetime(iso 8601)
  updated_at: datetime(iso 8601)
}
@fazlurr
fazlurr / send-outbound-message.md
Created April 7, 2022 03:29 — forked from nurcholisart/send-outbound-message.md
Documentation on how to send outbound message in Qiscus Multichannel via REST API

Send Outbound Message

Send individual message

Verb

POST https://multichannel.qiscus.com/api/v3/admin/broadcast/client
@fazlurr
fazlurr / nginx-tuning.md
Created July 8, 2021 17:42 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

<script>
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.createTemplateTagFirstArg=function(f){return f.raw=f};$jscomp.createTemplateTagFirstArgWithRaw=function(f,g){f.raw=g;return f};
(function(f,g){g=void 0===g?!1:g;var l=function(c,a,d){d=void 0===d?!1:d;a||(a=window.location.href);c="[?&]"+c.replace(/[\[\]]/g,"\\$&")+"(=([^&#]*)|&|#|$)";a=(d?new RegExp(c):new RegExp(c,"i")).exec(a);if(!a)return null;if(!a[2])return"";a=(a=a[2].replace(/\+/g," "))?decodeURIComponent(a.replace(/%(?![0-9][0-9a-fA-F]+)/g,"%25")):a;return a=a.replace(/[&<>="#;]/g,"")},m=function(c){c+="=";for(var a=document.cookie.split(";"),d=0;d<a.length;d++){for(var b=a[d];" "===b.charAt(0);)b=b.substring(1,b.length);
if(0===b.indexOf(c))return b.substring(c.length,b.length)}return null},n=function(c,a){var d=encodeURIComponent,b=function(e){return e+"="+c[e]};(void 0===a?0:a)&&(b=function(e){return d(e)+"="+d(c[e])});return Object.keys(c).map(b).join("&")};setTimeout(function(){var c=f;c=void 0===c?"oo-link":c;var a=l("fbclid"),d=m("fbp")
<script>
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.createTemplateTagFirstArg=function(f){return f.raw=f};$jscomp.createTemplateTagFirstArgWithRaw=function(f,g){f.raw=g;return f};
(function(f){var g=function(d,a,c){c=void 0===c?!1:c;a||(a=window.location.href);d="[?&]"+d.replace(/[\[\]]/g,"\\$&")+"(=([^&#]*)|&|#|$)";a=(c?new RegExp(d):new RegExp(d,"i")).exec(a);if(!a)return null;if(!a[2])return"";a=(a=a[2].replace(/\+/g," "))?decodeURIComponent(a.replace(/%(?![0-9][0-9a-fA-F]+)/g,"%25")):a;return a=a.replace(/[&<>="#;]/g,"")},l=function(d){d+="=";for(var a=document.cookie.split(";"),c=0;c<a.length;c++){for(var b=a[c];" "===b.charAt(0);)b=b.substring(1,b.length);if(0===b.indexOf(d))return b.substring(d.length,
b.length)}return null},m=function(d,a){var c=encodeURIComponent,b=function(e){return e+"="+d[e]};(void 0===a?0:a)&&(b=function(e){return c(e)+"="+c(d[e])});return Object.keys(d).map(b).join("&")};setTimeout(function(){var d=f;d=void 0===d?"oo-link":d;var a=g("fbclid"),c=l("fbp"),b=l("fbc");d=docume
const query = {};
query.until = until;
const params = { query };
this.$router.push(params);
cd %APPDATA%\nvm\v8.10.0 # or whatever version you're using
mv npm npm-old
mv npm.cmd npm-old.cmd
cd node_modules\
mv npm npm-old
cd npm-old\bin
node npm-cli.js i -g npm@latest
cd %APPDATA%\nvm\v8.10.0 # or whatever version you're using
rm npm-old
@fazlurr
fazlurr / ContentEditor.vue
Last active December 14, 2023 21:19
tiptap alignment And custom image handler
<template>
<!-- WYSIWYG Editor -->
<div class="editor mb-4">
<editor-menu-bar class="editor-bar" :editor="editor">
<div slot-scope="{ commands, isActive, focused, getMarkAttrs }">
<!-- Image -->
<label
class="btn btn-plain mb-0"
:class="{ 'is-loading': isUploading }"
v-tooltip="'Add Image'">