Skip to content

Instantly share code, notes, and snippets.

@wojteklu
wojteklu / clean_code.md
Last active May 6, 2024 15:33
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

# This supports merging as many adapters as you want.
# python merge_adapters.py --base_model_name_or_path <base_model> --peft_model_paths <adapter1> <adapter2> <adapter3> --output_dir <merged_model>
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
import os
import argparse
@ElanDeyan
ElanDeyan / main.dart
Created May 6, 2024 15:27
Dart read-only function parameters.
void main() {}
@juanjovn
juanjovn / AnimatedSelector.swift
Created April 20, 2024 18:10
Animated Icon Selector in SwiftUI
import SwiftUI
struct AnimatedSelector: View {
// Change this model for the proper case you need.
@Binding var selectedType: AnimatedSelectorType
// This boolean is used to disable the animated hand
@State var touchedAnySocialMedia = false
@axel-op
axel-op / dart-github-actions.md
Last active May 6, 2024 15:28
3 ways to build a GitHub Action with Dart

3 ways to build a GitHub Action with Dart

In 2020, I published the Pub package github_actions_toolkit to write GitHub Actions with Dart more easily. However, GitHub Actions runners don't support natively the Dart language, and some steps are necessary to execute a Dart program in a GitHub Actions workflow.

Below I compare three ways to create a GitHub Action with Dart, with their pros and cons.

. Shared Dart container Isolated Dart container Natively compiled executable
✍️ Defines the environment User Developer Developer
@FreddieOliveira
FreddieOliveira / docker.md
Last active May 6, 2024 15:28
This tutorial shows how to run docker natively on Android, without VMs and chroot.

Docker on Android 🐋📱

Edit 🎉

All packages, except for Tini have been added to termux-root. To install them, simply pkg install root-repo && pkg install docker. This will install the whole docker suite, left only Tini to be compiled manually.


Summary

@maxivak
maxivak / 00.md
Last active May 6, 2024 15:27
Sending emails with ActionMailer and Sidekiq

Sending emails with ActionMailer and Sidekiq

Send email asynchroniously using Sidekiq.

ActionMailer

Create your mailer us usual:

@brianfoshee
brianfoshee / flag-emoji.js
Last active May 6, 2024 15:26
Generate a Country's Flag Emoji given its 2 letter Country Code
// Generate a Country's Flag Emoji given its 2 letter Country Code
// https://emojipedia.org/flags/
function flagEmojiFromCountryCode(code) {
if (code.length != 2) {
// Must be ISO 3166-1 alpha-2
throw new Error(`Country Code "${code}" must be 2 characters`);
}
var base = 0x1F1E6 // hex of unicode code point for 🇦, "Regional Indicator Symbol Letter A"
var a = 'a'.charCodeAt(0) // => 97. Used for calculating unicode offsets from base.
@fabiomagno
fabiomagno / lista oficial.m3u
Last active May 6, 2024 15:25
lista oficial.m3u
#EXTM3U
#PLAYLISTV: pltv-logo="http://files.fabiomagno.webnode.com/200000054-6d18c6e133-public/.facebook_1491010981683.jpg" pltv-name="FABIO MAGNO" pltv-description="LISTA DE FILMES, SERIES, ANIMES, DESENHOS E VARIEDADES" pltv-cover="http://www.cepe.com.br/images/miv/CiaEditora
#EXTINF:-1 tvg-logo="http://i.imgur.com/PysT8xnh.jpg" group-title="ATUALIZAÇÕES DO DIA", ARROW T6|EP12 (LEG)
http://cdn1.ntcdn.us/content/httpdelivery/arrow/06leg/12-ALTO.mp4?STANIPTV
#EXTINF:-1 tvg-logo="http://www.mmfilmes.tv/wp-content/uploads/2018/02/p14477551_p_v8_aa-200x300.jpg" group-title="ATUALIZAÇÕES DO DIA",THE SOUND - DUB - HD (2017)
http://s.vstreaming.net/movies/osom-dub-720p.mp4?STANIPTV
#EXTINF:-1 tvg-logo="http://www.mmfilmes.tv/wp-content/uploads/2018/02/unnamed-file-91-200x300.jpg" group-title="ATUALIZAÇÕES DO DIA",BATMAN: GOTHAM BY GASLIGHT - DUB - HD (2018)
http://s.vstreaming.net/movies/batmangaslight-dub-720p.mp4?STANIPTV