Skip to content

Instantly share code, notes, and snippets.

View danielkellyio's full-sized avatar

Daniel Kelly danielkellyio

View GitHub Profile
@danielkellyio
danielkellyio / app.vue
Created January 12, 2023 19:28
app.vue
<script setup>
import { ref, computed } from "vue";
import ProductCard from "./components/ProductCard.vue";
import { useFetch } from "./composables/useFetch";
// loading products
const { data, loading } = useFetch(
"https://dummyjson.com/products?limit=10000"
);
const products = computed(() => data.value?.products || []);
{
"tables": [
{
"id": "62757cc0e3b8400009599e54",
"name": "Boards",
"displayName": "boards",
"isSystem": false,
"fields": [
{
"id": "62757cc0e3b8400009599e5e",
dynamic-link-screenshare
@danielkellyio
danielkellyio / vs-code-extensions.txt
Last active May 12, 2023 08:16
My VS Code Extensions
amiralizadeh9480.laravel-extra-intellisense
antfu.iconify
apollographql.vscode-apollo
atlassian.atlascode
be5invis.toml
bierner.markdown-preview-github-styles
bradlc.vscode-tailwindcss
buenon.scratchpads
csstools.postcss
dbaeumer.vscode-eslint
@danielkellyio
danielkellyio / typescript.json
Created March 9, 2022 20:51
Vue/TS defineEmits VS Code Snippet
{
"Vue defineEmits":{
"prefix": "defineEmits",
"body" : [
"defineEmits<{",
" (e: \"${1:event}\", ${2:payload}: { $3 }): void;",
"}>();",
],
"description": "defineEmits type declaration for Vue.js components"
},
@danielkellyio
danielkellyio / javascript.json
Last active October 2, 2024 09:38
VS Code Snippet for Defining Pinia Stores
{
"Pinia Store Boilerplate": {
"prefix": "pinia",
"body": [
"import { defineStore, acceptHMRUpdate } from \"pinia\";",
"",
"export const use$TM_FILENAME_BASE = defineStore(\"$TM_FILENAME_BASE\", {",
" state: () => {",
" return {",
" $0",
@danielkellyio
danielkellyio / settings.json
Last active September 21, 2023 13:36
VS Code Settings (for Recording)
{
"css.validate": false,
"tailwindCSS.emmetCompletions": true,
"workbench.colorTheme": "Material Theme Darker High Contrast",
"git.autofetch": true,
"editor.fontSize": 14,
"editor.fontFamily": "JetBrains Mono",
"editor.fontLigatures": true,
// "eslint.format.enable": true,
// "editor.formatOnSaveMode": "modifications",
@danielkellyio
danielkellyio / Cache.test.js
Created July 2, 2021 02:33
Cache Class Helper Unit Test Example
import Cache from '~/helper/Cache'
describe('Cache class', ()=>{
test('get method retrieves items from the cache', ()=>{
const cache = new Cache()
cache.put('hello', 'world')
expect(cache.get('hello')).toBe('world')
})
test('put method adds items to the cache', ()=>{
(new Cache).put('hello', 'world')
@danielkellyio
danielkellyio / Cache.js
Created July 2, 2021 02:31
Cache Class Helper Example
/**
* docs: /docs/cache.md
*/
import LZUTF8 from 'lzutf8'
window.LZUTF8 = LZUTF8
let cache = { 'default': {} }
try{
cache = JSON.parse( LZUTF8.decompress(localStorage.getItem('app_cache'), {inputEncoding: 'StorageBinaryString'}) )
Object.keys(cache).forEach(groupName =>{
@danielkellyio
danielkellyio / string.test.js
Last active July 2, 2021 02:34
String Test Example
import {ucFirst, snakeCase, camelCase, sentenceCase, ucWords, titleCase, nestedFromDot} from '~/helper/string'
describe('string helper functions', ()=>{
test('ucFirst capitalizes the first letter in a string', ()=>{
expect(ucFirst('hello world')).toBe('Hello world')
})
test('ucWords capitalizes the first letter in each word of a string', ()=>{
expect(ucWords('hello world')).toBe('Hello World')
})