Skip to content

Instantly share code, notes, and snippets.

Avatar
🚨
Git Inspector

Andrew iamandrewluca

🚨
Git Inspector
View GitHub Profile
@iamandrewluca
iamandrewluca / bookmarks-to-notion.js
Last active Jul 25, 2022
Export browser bookmarks, import them in Notion as a database
View bookmarks-to-notion.js
(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 / MyModel.php
Last active Jun 17, 2022
typo3 extbase categories
View MyModel.php
<?php
/**
* categories
*
* \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\Category>
* @lazy
*/
protected $categories;
/**
* MyModel constructor.
@iamandrewluca
iamandrewluca / open-localhost.js
Last active May 24, 2022
Open any URL with origin as localhost:3000 #bookmarklet
View open-localhost.js
javascript: void((function () {
/* More bookmarklets at https://gist.github.com/iamandrewluca/61feacf07bc4f2f50e70f986c2e9b2d2 */
/**
* Add your own mappers, first found will be used
* @type {{host: string, startsWith: string}[]}
*/
const hostMapper = [
{ startsWith: 'https://example.org', host: 'localhost:3000' },
{ startsWith: 'https://example.org/admin', host: 'localhost:3001' },
];
@iamandrewluca
iamandrewluca / oss-tools.md
Last active May 20, 2022
Open source software tools
View oss-tools.md
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)
@iamandrewluca
iamandrewluca / bookmarklets.md
Last active Apr 12, 2022
Collection of bookmarklets that I use day to day #bookmarklets
View bookmarklets.md

Any other ideas are welcome. Just ask if what you want is possible.

Post: https://dev.to/iamandrewluca/bookmarklets-browser-search-engine-2m30

  • [Generate a password in browser][1]
  • [Toggle password inputs to text back and forth][2]
  • [Request picture in picture on first found video that is playing][3]
  • [Open any URL with host as localhost:3000][4]
  • [Random table flip text emoji][5]
  • [Random Shrug text emoji][6]
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 / permissions.ts
Last active Nov 10, 2021
permissions based rendering
View permissions.ts
import { AdminUserRole } from 'gto-patterns'
/**
* A string combined of resource and method separated by a colon `:` e.g. 'user:get'
* Desired to keep resource as a singular word
* Nested resources can be separated by a slash `/` e.g. 'user/account-type:edit'
* A resource can contain one of owned fields separated by `@` e.g. 'user@registrationDate:get'
* Default methods are list, get, create, update, delete (https://cloud.google.com/apis/design/standard_methods)
* Custom methods can be added e.g. block, import, assign, generate
* These rules are invented, if anyone has a better idea how to categorize actions, please suggest.