Skip to content

Instantly share code, notes, and snippets.

View lucatsf's full-sized avatar
🐺
Working from home

Lucas Torres lucatsf

🐺
Working from home
View GitHub Profile
@mrodal
mrodal / InfiniteScroll.vue
Created February 14, 2021 15:27
Vuetify Infinte Scroll Component
<template>
<div>
<div v-for="(item, i) in items" :key="i" v-intersect="onIntersect" :data-last="i === items.length - 1">
<slot :item="item"></slot>
</div>
</div>
</template>
<script lang="ts">
import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
/* CHAT STYLES */
* {
font-family: Avenir, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto,
Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji,
Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
letter-spacing: 0.5px;
}
.ce-chat-list {
background-color: rgb(240, 240, 240) !important;
@davidcsejtei
davidcsejtei / exportService.js
Created October 21, 2020 12:03
Export from JavaScript to Excel (xlsx)
const xlsx = require('xlsx');
const path = require('path');
const exportExcel = (data, workSheetColumnNames, workSheetName, filePath) => {
const workBook = xlsx.utils.book_new();
const workSheetData = [
workSheetColumnNames,
... data
];
const workSheet = xlsx.utils.aoa_to_sheet(workSheetData);
@marcel-dempers
marcel-dempers / devilspie-vscode-transparency.sh
Created September 22, 2019 09:49
How to make VSCode transparent in Linux
#!/bin/bash
sudo apt-get install -y devilspie
mkdir -p ~/.devilspie
echo '
(if (contains (window_class) "Code")
(begin
(spawn_async (str "xprop -id " (window_xid) " -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 "))
(spawn_async (str "xprop -id " (window_xid) " -f _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY 0xD8000000"))
@jacklorusso
jacklorusso / workbench.colorCustomizations.json
Last active December 19, 2023 07:40
A list of all Visual Studio Code customizable colors, grouped by UI region. Copy and paste into User Settings (comments are allowed) to tweak an existing theme or work on your own.
"workbench.colorCustomizations": {
// Contrast Colors - The contrast colors are typically only set for high contrast themes. If set, they add an additional border around items across the UI to increase the contrast.
"contrastActiveBorder": "",
"contrastBorder": "",
// Base Colors
"focusBorder": "",
"foreground": "",
"widget.shadow": "",
"selection.background": "",
"descriptionForeground": "",
@julianobailao
julianobailao / mysql-docker.sh
Created February 22, 2018 13:05
Backup / restaurar um banco de dados mysql de um container Docker em execução
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restaurar
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@djaiss
djaiss / progress_bar_migration_laravel.php
Last active May 4, 2024 15:03
Laravel: Use progress bars in migrations
<?php
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Output\ConsoleOutput;
class DoSomething extends Migration
{
public function up()
{
$output = new ConsoleOutput();
@NigelEarle
NigelEarle / Knex-Migrations-Seeding.md
Last active June 19, 2024 14:20
Migration and seeding instructions using Knex.js!

Migrations & Seeding

What are migrations??

Migrations are a way to make database changes or updates, like creating or dropping tables, as well as updating a table with new columns with constraints via generated scripts. We can build these scripts via the command line using knex command line tool.

To learn more about migrations, check out this article on the different types of database migrations!

Creating/Dropping Tables

## Introduction
This post aims to provide a simple example of how to use traits with Laravel Query Scopes. The trait will sort columns based on "sort" and "direction" being found within the request, while protecting the database of unwanted sorting by adding a "sortables" property to the model. The end result looks like this with a Post model as an example:
```
Post::sort(request())
```
### Sortable trait
@rogercbe
rogercbe / Sortable.php
Last active February 9, 2022 16:26
Sortable trait for sorting tables with relationships in Laravel with a table helper class for displaying the links as an extension of the Laravel Paginator
<?php
namespace App\Support;
use Illuminate\Database\Eloquent\Relations\HasOne;
trait Sortable
{
public function scopeSortable($query, $defaultSort = null, $direction = 'asc')
{