{"id":15821537,"url":"https://github.com/dgp1130/snippets","last_synced_at":"2025-04-01T06:45:41.190Z","repository":{"id":115117373,"uuid":"223005139","full_name":"dgp1130/snippets","owner":"dgp1130","description":"Some random Chrome DevTools snippets I've written.","archived":false,"fork":false,"pushed_at":"2021-10-06T20:06:45.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-05T07:40:59.864Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/dgp1130.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":"2019-11-20T18:50:28.000Z","updated_at":"2021-10-06T20:06:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"ea93a032-3aec-4d3d-9bae-fe88b7432ae6","html_url":"https://github.com/dgp1130/snippets","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/dgp1130%2Fsnippets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgp1130%2Fsnippets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgp1130%2Fsnippets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgp1130%2Fsnippets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dgp1130","download_url":"https://codeload.github.com/dgp1130/snippets/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246598180,"owners_count":20802975,"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":[],"created_at":"2024-10-05T07:40:18.525Z","updated_at":"2025-04-01T06:45:36.175Z","avatar_url":"https://github.com/dgp1130.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Snippets\n\nSet of \"snippets\" loaded in Chrome DevTools. Some do useful things which can be\nrun on demand, others and just random pieces of code while I was\nprototyping/debugging something. Some are written in TypeScript and can't be\nexecuted directly in the browser snippets windows. You need to run these in the\n[TypeScript playground](http://www.typescriptlang.org/play/).\n\n## Dependencies\n\n* [Node](https://nodejs.org/)\n* [Node Package Manager](https://npmjs.com/)\n\nJust run:\n\n```shell\nnpm install\n```\n\n## Import/Export\n\nSee [this Stack Overflow answer](https://stackoverflow.com/a/35002464).\n\nTL;DR: Open a DevTools-on-DevTools window by opening DevTools _undocked_, and\nthen press `Ctrl+Shift+I` to inspect it with a second DevTools window. The\nconsole in this second window should have access to the `InspectorFrontendHost`\nAPI.\n\n### Import\n\nTo import snippets from Chrome DevTools to this Git repository, you must first\nexport the data from Chrome. Execute in the DevTools-on-DevTools console:\n\n```javascript\nInspectorFrontendHost.getPreferences((prefs) =\u003e console.log(JSON.stringify(JSON.parse(prefs.scriptSnippets), null /* replacer */, 4 /* tabSize */)));\n```\n\nThen copy paste the output to a JSON file and run:\n\n```shell\nnpm start import \u003cfile.json\u003e\n```\n\nThis will update the `snippets/` directory with all the content. You can then\ncommit and push the snippets.\n\n### Export\n\nWARNING: This will overwrite any existing snippets with the same names of the\nexported snippets. Any unrelated snippets with unique names are left alone.\n\nTo export from this repository to Chrome DevTools, run:\n\n```shell\n# Don't use `npm start`, because it includes extra output you don't want.\nnode_modules/.bin/ts-node index.ts export\n# Consider piping this into the relevant copy script to put stdout on the clipboard.\n```\n\nThen copy the output and then paste it in the DevTools-on-DevTools console.\nClose and reopen the DevTools windows to see the imported snippets.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdgp1130%2Fsnippets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdgp1130%2Fsnippets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdgp1130%2Fsnippets/lists"}