Skip to content

Instantly share code, notes, and snippets.

Avatar
🚨
Git Inspector

Andrew iamandrewluca

🚨
Git Inspector
View GitHub Profile
View resume.json
{
"$schema": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
"meta": {
"version": "1.0.0",
"lastModified": "2022-04-23",
"canonical": "https://raw.githubusercontent.com/iamandrewluca/jsonresume/main/resume.json"
},
"basics": {
"name": "Andrew Luca",
"email": "iamandrewluca@gmail.com",
View parse-strange-unit.js
let unit = `5" x 5' x 1-3/16"`
unit.split('x')
.map((v) => v.trim())
.map((v) => ({ value: removeUnit(v), unit: getUnit(v) }))
.map(({ unit, value }) => ({ unit, value: value.split('-') }))
.map(({ unit, value: [whole, fraction] }) => ({ unit, whole, fraction: splitFraction(fraction) }))
.map(({ unit, whole, fraction }) => ({ unit, value: parseInt(whole) + divideTuple(fraction) }))
.map(o => convertToInch(o))
.reduce((product, o) => product * o.value, 1)
View README.md

Generate a file with all file names

for f in *.mp4; do echo file \'$f\' >> fileList.txt; done;

Merge all files together

ffmpeg -f concat -safe 0 -i fileList.txt -c copy output.mp4
@iamandrewluca
iamandrewluca / git-reset-author.sh
Last active Dec 1, 2021
Change commit author using a rebase
View git-reset-author.sh
git rebase -x "git commit --amend --reset-author --no-edit" main
@iamandrewluca
iamandrewluca / README.md
Last active Nov 1, 2021
unlike/delete tweets
View README.md
  • Go to https://twitter.com/settings/download_your_data
  • Request all your data
  • After a day receive zip from Twitter
  • Extract zip
  • Create file likes.json from data/like.js that contains an array only of expandedUrl strings
  • Create a temporary folder where you have permissions on file system (to keep Twitter session)
  • Change in run.js userDataDir to point to created directory
  • Comment for loop in run.js
  • Run script, will open browser
  • Login on Twitter
View redux-replacement.ts
// eslint-disable-next-line react-hooks/rules-of-hooks
let _store: ReturnType<typeof useReducer>
function useStore() {
const store = useRef(useReducer((s: any, a: any) => {
return {}
}, {}))
_store = _store ?? store.current
return _store
}
@iamandrewluca
iamandrewluca / add-script.js
Last active Oct 13, 2021
Add a script to page #bookmarklet
View add-script.js
javascript: ((s) => {
"use strict";
if (s === atob("JXM=")) s = prompt();
/**
* More bookmarklets at
* https://gist.github.com/iamandrewluca/61feacf07bc4f2f50e70f986c2e9b2d2
* When used as a browser search engine `s` will be what user typed in address bar
*/
const script = document.createElement("script");
@iamandrewluca
iamandrewluca / new-quick-note.js
Created Sep 8, 2021
Open an empty tab as editable note #bookmarklet
View new-quick-note.js
javascript: void ((function() {
/* More bookmarklets at https://gist.github.com/iamandrewluca/61feacf07bc4f2f50e70f986c2e9b2d2 */
// create an empty page data uri
// make it content editable
// open in new tab
})());
@iamandrewluca
iamandrewluca / google-meet-pip-you.js
Last active Sep 29, 2021
Google Meet, open your video Picture in Picture mode #bookmarklet
View google-meet-pip-you.js
javascript: void ((function(userName = 'You') {
/* More bookmarklets at https://gist.github.com/iamandrewluca/61feacf07bc4f2f50e70f986c2e9b2d2 */
function findUpElementByDataAttribute(element, attr) {
if (element) {
return element.dataset[attr] ? element : findUpElementByDataAttribute(element.parentElement, attr);
}
}
const usersElements = [...document.querySelectorAll('[data-initial-participant-id] [data-self-name]')];
@iamandrewluca
iamandrewluca / njt-default-github.js
Last active Sep 8, 2021
Extended njt.vercel.app but with GitHub as default, and TypeScript Search #bookmarklet
View njt-default-github.js
javascript: void ((function(query) {
/* More bookmarklets at https://gist.github.com/iamandrewluca/61feacf07bc4f2f50e70f986c2e9b2d2 */
const [packageName, destination = 'g'] = decodeURIComponent(query).split('+').join(' ').split(' ');
if (destination === 'ts') {
window.location.href = `https://www.typescriptlang.org/dt/search?search=${packageName}`;
} else {
window.location.href = `https://njt.vercel.app/jump?to=${packageName} ${destination}`;
}
})('%s'));