Skip to content

Instantly share code, notes, and snippets.

View seantunwin's full-sized avatar

Sean T. Unwin seantunwin

View GitHub Profile
@seantunwin
seantunwin / vue-sfc.code-snippets
Last active December 6, 2023 18:55
Vue 3 SFC VSCode Snippet
"Vue 3 SFC": {
"scope": "javascript, typescript, vue",
"prefix": "vue-sfc",
"body": [
"<script setup lang=\"ts\">",
"\t$1",
"</script>",
"\n",
"<template>",
"\t<${2:div}>",
/* https://github.com/LinkedInLearning/simplifying-web-development-with-accessibility-best-practices-2883015 */
.sr-only {
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
height: 1px;
width: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
@seantunwin
seantunwin / Front End: Vue
Last active August 9, 2023 18:04
VSCode Profile for Vue 3 projects
{"name":"Front End: Vue","settings":"{\"settings\":\"{\\n \\\"workbench.colorCustomizations\\\": {\\n \\\"tree.indentGuidesStroke\\\": \\\"#f8f8f2\\\",\\n \\\"editorIndentGuide.activeBackground\\\": \\\"#f8f8f2\\\",\\n \\\"editorIndentGuide.background\\\": \\\"#44475a\\\"\\n },\\n \\\"editor.trimAutoWhitespace\\\": true,\\n \\\"editor.tabSize\\\": 2,\\n \\\"emmet.includeLanguages\\\": {\\n \\\"vue-html\\\": \\\"html\\\",\\n \\\"vue\\\": \\\"html\\\"\\n },\\n \\\"[vue]\\\": {\\n \\\"editor.defaultFormatter\\\": \\\"esbenp.prettier-vscode\\\"\\n },\\n \\\"[typescript]\\\": {\\n \\\"editor.defaultFormatter\\\": \\\"esbenp.prettier-vscode\\\"\\n }\\n}\"}","snippets":"{\"snippets\":{\"vue-sfc-setup-ts-scss.code-snippets\":\"{\\n\\t// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and \\n\\t// description. Add comma separated ids of the languages where the snippet is applicable in the scope fi
@seantunwin
seantunwin / remove-excess-same-character.js
Last active February 26, 2020 19:54
avaScript: Remove excess same character when maximum limit of same character
/* Limit character to repeat 3 times maximum */
'ffdttttyyqqqqqqq'.replace(/(.)\1{3,}/g, '$1$1$1');
// 'ffdtttyyqqq'
@seantunwin
seantunwin / get-table-contents.js
Created February 20, 2020 21:49
Get cell contents from an HTML table
/* Table structure
<table>
<tr>
<th>Email</th>
<th>Username</th>
</tr>
<tr>
<td>fake@data.com</td>
<td>UsernameHere</td>
</tr>
@seantunwin
seantunwin / last-uri-segment.js
Created November 5, 2019 16:43
JavaScript: Get string after last slash
str.substring(str.lastIndexOf('/') + 1);
@seantunwin
seantunwin / convert-deep-object-to-array.php
Created September 20, 2019 13:22
PHP: Convert Deep Nested Object to Associative Array
<?php
// Convert Deep Object to Associative Array
$adata = json_decode(json_encode($odata), true);
@seantunwin
seantunwin / get-hostname-from-ip.ps1
Created September 11, 2019 17:11
PowerShell: Get HostName from IP
[System.Net.Dns]::GetHostByAddress($ipAddress).Hostname
@seantunwin
seantunwin / rename-dir-files-with-parenthesis.ps1
Last active August 20, 2019 18:51
PowerShell: Rename dir files with parenthesis and content within
# Add -Recurse to do child directories
# Remove -WhatIf when satisfied with test run
Get-ChildItem | Rename-Item -NewName { $_.name -replace ' \(.*\)','' } -WhatIf
@seantunwin
seantunwin / Hyper-V_switch.bat
Created August 8, 2019 16:49
Hyper-V: Turn on/off to use between VirtualBox and Docker for Windows
### Reboot is required before changes will take effect
# Disable Hyper-V
## Required to use VirutalBox
bcdedit /set hypervisorlaunchtype off
# Enable Hyper-V
## Required to use Docker for Windows
bcdedit /set hypervisorlaunchtype auto