Skip to content

Instantly share code, notes, and snippets.

View ktpm489's full-sized avatar
🎯
Focusing

ktpm489

🎯
Focusing
View GitHub Profile
@ktpm489
ktpm489 / books.md
Created February 2, 2021 07:00 — forked from abstractart/books.md
Free Programming Ebooks - O'Reilly Media. Codeship free ebooks here - https://bit.ly/2oQ0knQ
@ktpm489
ktpm489 / ImageTools.js
Created October 31, 2020 04:24 — forked from SagiMedina/ImageTools.js
Resize and crop images in the Browser with orientation fix using exif
import EXIF from 'exif-js';
const hasBlobConstructor = typeof (Blob) !== 'undefined' && (function checkBlobConstructor() {
try {
return Boolean(new Blob());
} catch (error) {
return false;
}
}());
@ktpm489
ktpm489 / gist:29011f48668afe0c4f43b9eec04fc243
Created October 5, 2020 17:00 — forked from borismus/gist:1032746
Convert a base64 string into a binary Uint8 Array
var BASE64_MARKER = ';base64,';
function convertDataURIToBinary(dataURI) {
var base64Index = dataURI.indexOf(BASE64_MARKER) + BASE64_MARKER.length;
var base64 = dataURI.substring(base64Index);
var raw = window.atob(base64);
var rawLength = raw.length;
var array = new Uint8Array(new ArrayBuffer(rawLength));
for(i = 0; i < rawLength; i++) {
RabittMQ / Erlang remote connection configuration issues/notes/solutions
=========================================================================
Testing with "rabbitmq-server_1.7.2" on Ubuntu 10.04, "ami-2d4aa444"
"name" vs "sname"
------------------
http://www.oceanobservatories.org/spaces/display/CIDev/Distributed+Erlang+and+OTP
@ktpm489
ktpm489 / findLongRunningOp.js
Created September 25, 2020 09:15 — forked from kylemclaren/findLongRunningOp.js
Find and (safely) kill long running MongoDB ops
db.currentOp().inprog.forEach(
function(op) {
if(op.secs_running > 5) printjson(op);
}
)
@ktpm489
ktpm489 / README-Template.md
Created September 7, 2020 02:50 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@ktpm489
ktpm489 / app.js
Created August 16, 2020 15:41 — forked from joshnuss/app.js
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./authorization"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
version: "3"
services:
mongo1:
hostname: mongo1
container_name: localmongo1
image: mongo:4.0-xenial
expose:
- 27017
ports:
- 27011:27017
@ktpm489
ktpm489 / js-expired-token.js
Created April 18, 2020 04:28 — forked from paulnguyen-mn/js-expired-token.js
Xử lý expired token trong javascript (js nâng cao)
// Easy Frontend
// Học FE đơn giản, dễ hiểu và đặc biệt phải vui ❤️
// JS NÂNG CAO - Xử lý expired token trong Javascript như thế nào?
// ❓ Chuyện gì xảy ra nếu giữa chừng token bị expired?
// Ví dụ: 3 api requests đồng thời với nhau
// TRƯỜNG HỢP 1: Token chưa expired, vẫn còn tốt chán 🤣
// --request 1-->