Skip to content

Instantly share code, notes, and snippets.

Avatar

Claudio Holanda kazzkiq

View GitHub Profile
View Erros da API.yaml
required: "The '{field}' field is required.",
string: "The '{field}' field must be a string.",
stringEmpty: "The '{field}' field must not be empty.",
stringMin: "The '{field}' field length must be greater than or equal to {expected} characters long.",
stringMax: "The '{field}' field length must be less than or equal to {expected} characters long.",
stringLength: "The '{field}' field length must be {expected} characters long.",
stringPattern: "The '{field}' field fails to match the required pattern.",
stringContains: "The '{field}' field must contain the '{expected}' text.",
stringEnum: "The '{field}' field does not match any of the allowed values.",
@kazzkiq
kazzkiq / exemplo-rota-hydration.svelte
Last active Apr 17, 2022
Exemplo de rota SvelteKit que chama APIs já no backend e retorna a tela hidratada no front.
View exemplo-rota-hydration.svelte
<script context="module">
// Ao invés de fazer essas chamadas para APIs dentro dos componentes (Componente1 e Componente2)
// ela já é feita aqui na rota, dentro desse bloco context="module", e retornada como props
// para a própria tela.
// E aí a tela é que passa os dados para os componentes via props.
export async function load ({ params, fetch }) {
const result = await (await fetch("ENDPOINT_DA_API_AQUI")).json();
return {
props: {
@kazzkiq
kazzkiq / Tutorial.md
Created Jan 19, 2022
Download entire website with wget
View Tutorial.md

Simply run this command:

wget --mirror --convert-links --adjust-extension --page-requisites --no-parent http://example.org

The command will download the website and any link it finds, and update those links to run even if you call them locally.

View Error stacktrace
INFO [14:40:32.431 #75876] ⬛ Onyx::HTTP::Server is listening at http://127.0.0.1:5000
DEBUG [14:40:35.927 #75876] [sql] SELECT * FROM bookmarks WHERE (bookmarks.id = ?)
DEBUG [14:40:35.929 #75876] 2.42ms
DEBUG [14:40:35.929 #75876] [sql] UPDATE bookmarks SET date_modified = ? WHERE (bookmarks.id = ?)
ERROR [14:40:36.175 #75876] [875ff9eb] ERROR cast from DB::ExecResult to DB::ResultSet+ failed, at /Users/kazzkiq/Works
pace/Favhive/favhive-api/lib/mysql/src/mysql/statement.cr:34:5:34
cast from DB::ExecResult to DB::ResultSet+ failed, at /Users/kazzkiq/Workspace/Favhive/favhive-api/lib/mysql/src/mysql/st
atement.cr:34:5:34 (TypeCastError)
from lib/mysql/src/mysql/statement.cr:0:5 in 'perform_query'
View bookmarks.cr
struct Endpoints::Bookmarks::Update
include Onyx::HTTP::Endpoint
params do
path do
type id : Int32
end
json require: true do
type id_category : Int32?
@kazzkiq
kazzkiq / Link.html
Created Jun 5, 2018
Link Svelte Component (which replaces <a>)
View Link.html
@kazzkiq
kazzkiq / resize-images.sh
Created Nov 16, 2017
[bash] Resize image and create thumbnail with ImageMagick
View resize-images.sh
INDEX_RESIZE=0
for file in ./*.jpg; do
[ -e "$file" ] || continue
convert $file -resize 1000x1000^ $file
let INDEX_RESIZE=$(expr $INDEX_RESIZE+1)
done
INDEX_THUMBNAIL=0
for file in ./*.jpg; do
[ -e "$file" ] || continue
View unologo.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View sample.ux
<App>
<DockPanel>
<Rectangle Dock="Top" Background="#515a6d" Height="50">
<Text Alignment="Center" TextColor="#fff">Scroll Down</Text>
</Rectangle>
<Rectangle Dock="Bottom" Background="#515a6d" Height="50">
<Text Alignment="Center" TextColor="#fff">Scroll Down</Text>
</Rectangle>
<ScrollView Padding="20">
<Text TextWrapping="Wrap">
@kazzkiq
kazzkiq / tmce.css
Last active Dec 10, 2017
tmce.css
View tmce.css
@import url('https://fonts.googleapis.com/css?family=Lato:300,300i,400,400i');
.mce-content-body {
font-family: 'Lato', sans-serif;
font-size: 15px;
}
.mce-content-body * {
word-break: break-all;
}