Skip to content

Instantly share code, notes, and snippets.

@coltborg
coltborg / thymeleaf_script.sh
Last active April 20, 2023 18:14
Update fragment call in templates to use `~{}` syntax. First change file path to templates you want to affect.
#!/bin/sh
search_dir="/Users/alexgonzalez/Desktop/Code/form-flow/src/test/resources/templates"
# for each file in search directory and subdirectories, do the following
find "$search_dir" -type f -name "*.html" | while read file; do
sed -n '
/\(fragments.*\)"/ {
s/\(fragments.*\)"/~{\1}"/g
p
@coltborg
coltborg / VueWithSharedState.vue
Created December 11, 2019 01:26
Vue 3 Essentials - Sharing state
<template>
<div>
Search for <input v-model="searchInput" />
<div>
<p>Loading: {{ getEvents.loading }}</p>
<p>Error: {{ getEvents.error }}</p>
<p>Number of events: {{ getEvents.results }}</p>
</div>
</div>
</template>
@coltborg
coltborg / SetupWithWatch.vue
Created December 11, 2019 01:06
Vue 3 Essentials - Watch
<template>
<div>
Search for <input v-model="searchInput" />
<div>
<p>Number of events: {{ results }}</p>
</div>
</div>
</template>
<script>
@coltborg
coltborg / SetupWithLifecycle.vue
Created December 10, 2019 05:13
Vue 3 Essentials - Lifecycle hooks
<script>
import { onBeforeMount, onMounted } from "vue";
export default {
setup() {
onBeforeMount(() => {
console.log("Before mount!");
});
onMounted(() => {
@coltborg
coltborg / SetupWithComposition.vue
Created December 6, 2019 23:51
Vue 3 Essentials - Modularizing
<template>
<p>
Spaces left: {{ spacesLeft }} out of {{ capacity }}
</p>
<button @click="increaseCapacity">Increase Capacity</button>
<h2>Attending</h2>
<ul>
<li
v-for="(name, index) in attending"
:key="index"
@coltborg
coltborg / SetupWithReactive.vue
Created December 6, 2019 01:18
Vue 3 Essentials - The reactive syntax
<template>
<p>
Spaces left: {{ spacesLeft }} out of {{ capacity }}
</p>
<button @click="increaseCapacity">Increase Capacity</button>
<h2>Attending</h2>
<ul>
<li
v-for="(name, index) in attending"
:key="index"
@coltborg
coltborg / SetupWithComputed.vue
Last active December 6, 2019 01:19
Vue 3 Essentials - Computed properties
<template>
<p>
Spaces left: {{ spacesLeft }} out of {{ capacity }}
</p>
<button @click="increaseCapacity">Increase Capacity</button>
<h2>Attending</h2>
<ul>
<li
v-for="(name, index) in attending"
:key="index"
@coltborg
coltborg / SetupWithMethod.vue
Last active December 6, 2019 01:19
Vue 3 Essentials - Methods
<template>
<div>Capacity: {{ capacity }}</div>
<button @click="increaseCapacity">Increase Capacity</button>
</template>
<script>
import { ref } from "vue";
export default {
setup() {
@coltborg
coltborg / SetupExample.vue
Created December 4, 2019 17:19
Vue 3 Essentials - Setup & reactive references
<template>
<div>Capacity: {{ capacity }}</div>
</template>
<script>
import { ref } from 'vue';
export default {
setup() {
const capacity = ref(3); // Ref is used to wrap a primitive (number) inside of a reactive reference (object)
@coltborg
coltborg / css-basics.md
Last active February 27, 2019 02:50
CSS leason for box model & specificity.

CSS Basics


Agenda

  • Basics
  • The Cascade
  • Specificity
  • Box Model