Skip to content

Instantly share code, notes, and snippets.

View iamandrewluca's full-sized avatar
🚨
Git Inspector

Andrei Luca iamandrewluca

🚨
Git Inspector
View GitHub Profile
@iamandrewluca
iamandrewluca / GONE.md
Last active November 4, 2021 09:18
Git alias to remove all local branches that are gone on remote

Create alias manually in ~/.gitconfig file (recommened):

[alias]
	gone = "!f() { git fetch --all --prune; git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D; }; f"

Create alias (problematic):

@iamandrewluca
iamandrewluca / README.md
Last active December 23, 2022 11:47
Adjust repository field in package.json for all packages in a monorepo

Update package.json repository field to point to directory in a monorepo setup

Run Gist using npx and zx in repository folder

npx zx https://gist.githubusercontent.com/iamandrewluca/5cc85b56a595056f0099d04ed6dd8a79/raw/run.mjs \
--repository="https://github.com/facebook/react.git" \
--homepage="https://reactjs.org" \
--ignore="fixtures" \
--space="2"
@iamandrewluca
iamandrewluca / typescript-enums.ts
Last active July 24, 2021 00:50
3 types of TypeScript Enums
//////////////////////////////////////////////////////////////
export const buttonSizes_1 = ['small', 'medium'] as const
export type ButtonSize_1 = typeof buttonSizes_1[number]
function test_1(_: ButtonSize_1) {
console.assert(buttonSizes_1.includes(_))
}
test_1('medium') // we can do this
test_1(ButtonSize_1.small) // we can't do this
const routerPagesNames = {
forgotpassword: 'forgotpassword',
login: 'login',
resetPassword: 'reset-password',
index: {
index: 'index',
communication: 'index-communication',
content: 'index-content',
statistics: 'index-statistics',
users: 'index-users',
@iamandrewluca
iamandrewluca / CODE_FOR_MOLDOVA_CLA
Last active May 10, 2021 08:54
CODE FOR MOLDOVA Individual Contributor License Agreement
### CODE FOR MOLDOVA Individual Contributor License Agreement
Thank you for your interest in contributing to open source software projects (“Projects”) made available by CODE FOR MOLDOVA SE or its affiliates (“CODE FOR MOLDOVA”). This Individual Contributor License Agreement (“Agreement”) sets out the terms governing any source code, object code, bug fixes, configuration changes, tools, specifications, documentation, data, materials, feedback, information or other works of authorship that you submit or have submitted, in any form and in any manner, to CODE FOR MOLDOVA in respect of any of the Projects (collectively “Contributions”). If you have any questions respecting this Agreement, please contact contact@code4.md.
Hereby, by agreeing to the current provisions, you agree that the following terms apply to all of your past, present and future Contributions. Except for the licenses granted in this Agreement, you retain all of your rights, title and interest in and to your Contributions.
**Copyright Licens
@iamandrewluca
iamandrewluca / bookmarks-to-notion.js
Last active April 17, 2024 10:18
Export bookmarks to Notion as a Database
(function bookmarksExportToCsv() {
/**
* 1. Export bookmarks from browser (supported any Chromium based browsers and Safari) (chrome://bookmarks)
* 2. Open exported html file again in the browser
* 3. Copy paste this entire file in console, and execute it (hit enter)
* 4. You will be prompted to save a CSV file. Save it.
* 5. Open Notion. Click Import -> CSV
* 6. Select saved CSV file. Wait for import
* 7. You have a new database with all your bookmarks
*/
@iamandrewluca
iamandrewluca / remove-liked-videos.js
Last active April 29, 2024 16:12
Go to YouTube like videos playlist. Execute this script in console. Will start to remove likes from videos
const sleep = time => new Promise(resolve => setTimeout(resolve, time))
let items = []
const interval = setInterval(async function() {
if (items.length < 10) {
items = Array.from(document.querySelectorAll('#contents ytd-playlist-video-renderer:not([is-dismissed])'))
}
if (items.length === 0) {
clearInterval(interval)
return
}
const postcss = require("postcss");
const tailwind = require("tailwindcss");
const express = require("express");
const app = express();
app.get("/:configBase64/tailwind.css", async (req, res) => {
const buffer = Buffer.from(req.params.configBase64, "base64");
const config = JSON.parse(buffer.toString("utf-8"));
const baseCSS = `@tailwind base;@tailwind components;@tailwind utilities;`;
@iamandrewluca
iamandrewluca / find-duplicated-ids.js
Created June 29, 2020 18:04
Will search and mark duplicated IDs on a page #bookmarklet
javascript: void ((function() {
/* More bookmarklets at https://gist.github.com/iamandrewluca/61feacf07bc4f2f50e70f986c2e9b2d2 */
document.querySelectorAll('[id]').forEach(el => {
const specificIds = document.querySelectorAll(`[id="${el.id}"]`);
if (specificIds.length > 1 && specificIds[0] === el) {
console.log('Duplicate id ' + el.id);
specificIds.forEach(element => {
element.style.outline = '5px solid red';
});
alert('duplicate found');
@iamandrewluca
iamandrewluca / edit-website.js
Created June 29, 2020 17:59
Enable page editing #bookmarklet
javascript: void ((function() {
/* More bookmarklets at https://gist.github.com/iamandrewluca/61feacf07bc4f2f50e70f986c2e9b2d2 */
document.body.contentEditable = 'true';
document.designMode='on';
})());