Skip to content

Instantly share code, notes, and snippets.

View kazzkiq's full-sized avatar

Claudio Holanda Jr. kazzkiq

View GitHub Profile
@kazzkiq
kazzkiq / chat.md
Created February 27, 2025 18:59
iOS Background service

Conversation with Claude 3.5 Sonnet

Chat (user): I heard Apple iOS does not accept background tasks to keep running when an app is terminated. So if the user closes the app there is no way to keep running anything from that app in background, is that true?

While iOS is more restrictive with background processing compared to Android, there are several legitimate ways to perform background tasks in iOS, even when the app is not actively running:

  1. Background Modes (supported capabilities):
  • Audio playback
  • Location updates
  • VoIP
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 April 17, 2022 02:20
Exemplo de rota SvelteKit que chama APIs já no backend e retorna a tela hidratada no front.
<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 January 19, 2022 02:12
Download entire website with wget

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.

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'
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 June 5, 2018 23:44
Link Svelte Component (which replaces <a>)
@kazzkiq
kazzkiq / resize-images.sh
Created November 16, 2017 20:55
[bash] Resize image and create thumbnail with ImageMagick
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<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">