Skip to content

Instantly share code, notes, and snippets.

View lazzyms's full-sized avatar
👨‍💻

Maulik Sompura lazzyms

👨‍💻
View GitHub Profile
@lazzyms
lazzyms / index.html
Created March 26, 2019 09:04
THREE Text Animation #6
<div id="three-container"></div>
<div id="instructions">
click and drag to control the animation
</div>
@lazzyms
lazzyms / getallmail.js
Last active May 23, 2020 15:04
To get all the email from links with 'mailto' action with javascript.
var links = document.getElementsByTagName('a'), hrefs = [], sendIt = '';
for (var i = 0; i<links.length; i++)
{
if(links[i].href.includes('mailto')) {
var email = links[i].href.replace('mailto:','');
//If you want to use this as array
hrefs.push(email);
//If you want to copy all email ids in one string (usually to send mail to multiple ids at once)
sendIt += email + ', ';
@lazzyms
lazzyms / README.md
Last active July 28, 2020 15:44
Interview Question - the perfect curry

We want to prepare the perfect curry with ingredients P, Q, and R. "A" is a zero-indexed array of N integers. Elements of A are integers within the range [−99,999,999 to 99,999,999] The curry is a string consisting of N characters such that each character is either P, Q, or R and the corresponding index of the array is the weight of each ingredient. The curry is perfect if the sum of the total weights of P, Q, and R is equal. Write a function function makeCurry(Array); such that, given a zero-indexed array Array consisting of N integers, returns the perfect curry of this array. The function should return the string "noLuck" if no perfect curry exists for that Array.

@lazzyms
lazzyms / react.gitlab-ci.yml
Last active September 10, 2020 04:54
Deploy React build with gitlab-ci
image: node:10
cache:
paths:
- node_modules/
before_script:
- apt-get update -qq && apt install -y openssh-client openssh-server
- mkdir -p ~/.ssh
- echo -e "$SSH_PRIVATE_KEY" > ~/deploy.pem
@lazzyms
lazzyms / SelectionArea.jsx
Created January 29, 2024 06:28
SelectionArea component in react to drag and select the area of canvas.
import { useEffect, useState } from "react";
import { RhButton } from "@rhythm-ui/react";
const SelectionArea = ({ onCancel, onCapture }) => {
const [startPosition, setStartPosition] = useState({ x: 0, y: 0 });
const [endPosition, setEndPosition] = useState({ x: 0, y: 0 });
const [selectState, setSelectState] = useState("init");
const handleMouseDown = (e) => {
if (selectState == "init") {
const { clientX, clientY } = e;
@lazzyms
lazzyms / transform-css.js
Last active February 23, 2024 09:18
add prefix to tailwind class name in particular files within directory
const fs = require('fs');
const path = require('path');
const { tw } = require('./tw.cjs');
function addPrefixToClasses(filePath) {
console.log('processing... ', filePath);
const fileContent = fs.readFileSync(filePath, 'utf8');
let modifiedContent = fileContent;
tw.forEach((item) => {
console.log(item);