{"id":22294016,"url":"https://github.com/gerdesque/til","last_synced_at":"2025-03-25T22:19:07.772Z","repository":{"id":80268321,"uuid":"128363473","full_name":"gerdesque/til","owner":"gerdesque","description":"📝 Today I Learned","archived":false,"fork":false,"pushed_at":"2024-10-21T08:09:33.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-30T19:27:24.976Z","etag":null,"topics":["javascript","til","today-i-learned","writing"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gerdesque.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-06T07:25:30.000Z","updated_at":"2024-10-21T08:09:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"603b603a-5e2c-41d1-8b50-991b62a63f53","html_url":"https://github.com/gerdesque/til","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gerdesque%2Ftil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gerdesque%2Ftil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gerdesque%2Ftil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gerdesque%2Ftil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gerdesque","download_url":"https://codeload.github.com/gerdesque/til/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245550681,"owners_count":20633883,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","til","today-i-learned","writing"],"created_at":"2024-12-03T17:34:05.604Z","updated_at":"2025-03-25T22:19:07.749Z","avatar_url":"https://github.com/gerdesque.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# TIL\n\u003e 📝 Today I Learned\n\nA collection of concise write-ups on small things I learn day to day across a variety of languages and technologies.\n\n## A11Y\n\n- Enable in browser spellchecking via bookmark\n\n```javascript\njavascript:document.body.contentEditable='true';document.body.spellcheck='true';void%200\n```\n[source](https://developer.paciellogroup.com/blog/2017/02/in-browser-spellchecking/)\n\n## Cronjobs\n- Run brew update every monday at 11 am\n```bash\n0 11 * * 1 /usr/local/bin/brew update \u0026\u0026 /usr/local/bin/brew upgrade\n```\n\n## Git\n\n- Use git move to inform git about a case change of a file\n```bash\n$ git mv it.json IT.json\n```\n\n- Get every ticket number (commit message should be in the format `[#12345] Add foo`) of a period of time\n```bash\n$ git log --after 2018-03-26 | egrep -o '\\[#\\d*\\]' | sort | uniq\n```\n\n- Get every ticket number __and commit message__ (commit message should be in the format `[#12345] Add foo`) of a period of time\n```bash\n$ git log --after 2016-07-15 | egrep -o '\\[#\\d*\\](.*)' | sort | uniq\n```\n\n## Mac\n\n- By default, Mac saves all screenshots to the desktop. If you'd like screenshots to be dumped somewhere else, you have to configure it manually from the command line with\n```bash\n$ defaults write com.apple.screencapture location ~/Downloads\n$ killall SystemUIServer\n```\n\n## MySQL\n- You can run the following command to get a list of the databases on your server and the size in GB they are consuming:\n```sql\nSELECT table_schema \"Databases\", sum( data_length + index_length ) / 1024 / 1024 / 1024 \"Size (GB)\" FROM information_schema.TABLES GROUP BY table_schema;\n```\n\n## Regex\n\n- To anonymize files this regex replaces the full name with the initials of the person\n\n```bash\n#find expression\n(\\w{1}).*\\.(\\w{1}).*\n\n#text\nTest.Nutzer\n\n#replace expression\n$1.$2\n\n#result\nT.N\n```\n\n## JS\n- To read article of local journalism parse the content and display text\n\n```javascript\nconst demandForPayment = document.querySelector('.pdb-article-paidcontent-registration');\nif(demandForPayment) {\n    demandForPayment.remove();\n}\nconst article = document.querySelector(\".pdb-article script[type='application/ld+json']\");\nif(article) {\n    const articleContent = JSON.parse(article.textContent);\n    const scrambledArticleText = document.querySelector(\".pdb-article-body\");\n    if(scrambledArticleText) {\n        scrambledArticleText.innerText = articleContent.articleBody;\n    }\n}\n```\n\n```javascript\ndocument.getElementById(\"piano-inline\").style.display = \"none\";\ndocument.getElementById('article-content-bottom').className = '';\n```\n\n## Image Converter\n\n```bash\nfor F in *.jpg; do cwebp -q 80 $F -o `basename ${F%.jpg}`.webp; done\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgerdesque%2Ftil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgerdesque%2Ftil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgerdesque%2Ftil/lists"}