Skip to content

Instantly share code, notes, and snippets.

View ammoradi's full-sized avatar
🏡
Working from home

Amir Mohammad Moradi ammoradi

🏡
Working from home
View GitHub Profile
@ammoradi
ammoradi / string-codec.ts
Last active October 31, 2020 23:13
JavaScript simple string encoder/decoder written in TypeScript
// see [Inspiration Source](https://www.geeksforgeeks.org/decode-the-string-encoded-with-the-given-algorithm/)
// JavaScriptSimpleEncoder => iSmtpplierEcnScaovdaeJr
const encodeString = (inputStr: string): string => {
const len = inputStr.length
if (!len) return inputStr
const isLenEven = len % 2 === 0
@ammoradi
ammoradi / App-ReactVideoTrimmerAndConverter.js
Last active July 23, 2022 21:22
usage of @ffmpeg/ffmpeg to transcode and trim videos in react project
import React, { useState, useCallback } from 'react';
import './App.css';
import transformer from './transformer'
function App() {
const [videoSrc, setVideoSrc] = useState('');
const handleTranscode = useCallback(async ({ target: { files } }) => {
// you can use range slider