{"id":16558589,"url":"https://github.com/radarsh/til","last_synced_at":"2026-03-07T11:33:12.900Z","repository":{"id":145045137,"uuid":"53859634","full_name":"radarsh/til","owner":"radarsh","description":"Today I Learned","archived":false,"fork":false,"pushed_at":"2018-06-05T12:31:13.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-12T01:38:19.259Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"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/radarsh.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":"2016-03-14T13:44:52.000Z","updated_at":"2018-06-05T12:31:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"7bee1cb6-1a0e-41cb-9472-f10a375e2c07","html_url":"https://github.com/radarsh/til","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/radarsh/til","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radarsh%2Ftil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radarsh%2Ftil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radarsh%2Ftil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radarsh%2Ftil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/radarsh","download_url":"https://codeload.github.com/radarsh/til/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radarsh%2Ftil/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30212124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T09:02:10.694Z","status":"ssl_error","status_checked_at":"2026-03-07T09:02:08.429Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-10-11T20:23:06.512Z","updated_at":"2026-03-07T11:33:12.852Z","avatar_url":"https://github.com/radarsh.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Today I Learned\n\nA collection of TILs heavily inspired from [jbranchaud](https://github.com/jbranchaud/til).\n\n## 5/6/2018 - IntelliJ constructor breakpoint\n\nIn IntelliJ, while debugging a Java application you can set breakpoints on constructors to track creation of objects. However, what would you do if the class doesn't declare any constructors (has only the implicit default constructor)? Just set a line breakpoint on the class declaration line `public class MyClass {` and it will be hit whenever an instance of this class is created.\n\n## 20/07/2017 - IntelliJ Gradle dependency pasting\n\nIf you are looking to convert a Maven style dependency into Gradle style for use in your `build.gradle`, look no further. All you have to do copy something that looks like the below.\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003enet.logstash.logback\u003c/groupId\u003e\n  \u003cartifactId\u003elogstash-logback-encoder\u003c/artifactId\u003e\n  \u003cversion\u003e4.11\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nWhen you past it inside the `dependencies` block of your `build.gradle`, it gets automatically converted to the below format by intelligent IntelliJ.\n\n```\ncompile 'net.logstash.logback:logstash-logback-encoder:4.11'\n```\n\n## 7/11/2016 - Bash readline arguments\n\nI discovered this one by accident. Simply open Bash and type \u003ckbd\u003eAlt + `digit`\u003c/kbd\u003e followed by any character and you'll find the character repeated `digit` times on your prompt.\n\nMore about this at http://stackoverflow.com/questions/562115/press-alt-numeric-in-bash-and-you-get-arg-numeric-what-is-that\n\n## 14/03/2016 - CSS3 ch unit of measurement\n\nThis can be invaluable if you are trying to express the width of an element as a multiple of the character width.\nThe best part is that `ch` understands the changes in character width arising due to different font styles, sizes etc.\n\nExample:\n\n```css\n.panel {\n    font-style: Consolas, monospace;\n    font-size: 12px;\n}\n\n.drawer {\n    width: 10ch;\n}\n```\n\n```html\n\u003cdiv class=\"panel\"\u003e\n    \u003cp\u003e1234567890\u003c/p\u003e\n    \u003cdiv class=\"drawer\"\u003e\u003c/div\u003e\n\u003c/div\u003e\n```\n\nThe above will render both the `p` and the `div.drawer` elements at equal widths (provided the margins and paddings are set accordingly, of course).\n\nWhat's more, the browser support for this is remarkably good too.\n\n## 10/03/2016 - JavaScript input event\n\nThis is a robust way to handle changes to values of `input` and `textarea` elements. Browser support is excellent too. \n\nExample:\n\n```javascript\n$(\"input.class-name\").on(\"input\", function(e) {\n    console.log(\"Value: \", $(this).val());\n});\n```\n\nBefore finding out about this, I was using the `keyup`, `keydown` and `keypress` events but each one comes with its own set of limitations. For instance, the `keyup` and `keydown` events don't filter out special keys such as `Ctrl` and `Alt`. The `keypress` isn't even a standard event and it gets tricky if you want to grab the value of a field after the key has been pressed.\n\n## 26/02/2016 - Gradle offline mode\n\nExtremely handy when you have to execute a Gradle task without connecting to the internet or remote repositories in situations such as when you're in a coffee shop or have no access to the network but have already downloaded all the dependencies. \n\nSimply use the `--offline` switch in conjunction with your task commands. \n\nExample:\n\n```bash\n$ gradle clean build --offline\n```\n\nJust keep in mind that it will only work if you have already downloaded all the required dependencies when you had access to the network. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fradarsh%2Ftil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fradarsh%2Ftil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fradarsh%2Ftil/lists"}