Skip to content

Instantly share code, notes, and snippets.

@lmartim
lmartim / ScrollRectAutoScroll.cs
Last active March 26, 2025 22:52
Auto scroll vertically a ScrollRect when selecting a component outside the viewport
// https://www.reddit.com/r/Unity3D/comments/1epw3u6/need_some_help_with_scroll_view_auto_scroll/
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class ScrollRectAutoScroll : MonoBehaviour
@lmartim
lmartim / HelloWorld.vue
Last active October 1, 2021 03:21
File example with component from library
<template>
<section>
<h1>Hello World in New Project</h1>
<Button label="Button Label in New Project" type="primary" size="lg" />
</section>
</template>
<script>
import { defineComponent } from "vue";
@lmartim
lmartim / vite.config.js
Last active October 1, 2021 03:21
Vite config file on new project
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
css: {
preprocessorOptions: {
scss: {
additionalData: `
@lmartim
lmartim / lerna.json
Created October 1, 2021 02:45
Lerna config file
{
"packages": [
"dist"
],
"version": "independent"
}
@lmartim
lmartim / index.js
Created October 1, 2021 02:23
The export file for rollup
export { default as Button } from './components/Button/Button.vue'
@lmartim
lmartim / Button.stories.js
Last active September 30, 2021 04:03
Button component
//.src/components/Button/Button.stories.js
import Button from './Button.vue'
export default {
title: 'Components/Button',
component: { Button },
argTypes: {
label: {
type: 'string'
},
@lmartim
lmartim / _flex.scss
Last active September 30, 2021 03:16
Some styles
//.src/assets/styles/_flex.scss
.d {
&-iflex {
display: inline-flex !important;
}
&-flex {
display: flex !important;
}
}
@lmartim
lmartim / colors.json
Last active September 30, 2021 03:08
Some tokens
//.tokens/properties/colors
{
"color": {
"success": {
"darkest" : {
"value": "#004020",
"comment": "the darkest sucess color"
},
"dark" : {
"value": "#007339",
@lmartim
lmartim / Header.vue
Created September 28, 2021 03:04
Header component using color token
<template>
<h1>{{ text }}</h1>
</template>
<script>
import { defineComponent } from "vue";
export default defineComponent({
props: {
text: {
@lmartim
lmartim / rollup.config.js
Last active October 1, 2021 02:26
The rollup config for building the component library.
import vue from 'rollup-plugin-vue'
import { terser } from 'rollup-plugin-terser'
import postcss from 'rollup-plugin-postcss'
module.exports = [
{
input: 'src/index.js',
output: [
{
sourcemap: true,