Skip to content

Instantly share code, notes, and snippets.

@Danetag
Danetag / Sprite.js
Last active May 13, 2024 17:28
Simple class to play a PNG sequence into a canvas
// Here is a simple class that contains loading methods.
// Nothing fancy, but the idea is simply to return a Promise
import { loadImg } from './load';
class Sprite {
/*
@Example
import Sprite from './Sprite';
@Oleur
Oleur / ComposeCanvasText.kt
Last active May 13, 2024 17:27
Draw text on Jetpack Compose Canvas
val textPaint = Paint().asFrameworkPaint().apply {
isAntiAlias = true
textSize = 24.sp.toPx()
color = android.graphics.Color.BLUE
typeface = Typeface.create(Typeface.MONOSPACE, Typeface.BOLD)
}
Canvas(
modifier = modifier.fillMaxSize(),
onDraw = {
drawIntoCanvas {
@wojteklu
wojteklu / clean_code.md
Last active May 13, 2024 17:28
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

@vasanthk
vasanthk / System Design.md
Last active May 13, 2024 17:24
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
import { BatchExecuteStatementCommand, BatchExecuteStatementCommandInput, BatchGetCommand, BatchGetCommandInput, DeleteCommand, DeleteCommandInput, ExecuteStatementCommand, ExecuteStatementCommandInput, ExecuteTransactionCommand, ExecuteTransactionCommandInput, GetCommand, GetCommandInput, PutCommand, PutCommandInput, QueryCommand, QueryCommandInput, ScanCommand, ScanCommandInput, UpdateCommand, UpdateCommandInput } from "@aws-sdk/lib-dynamodb";
import { Logger } from "@nestjs/common";
import { DbClientsInstance } from "./db.clients";
class DbDataOps {
private static instance: DbDataOps;
private constructor() {
console.log('DbDataOps init');
if(DbDataOps.instance) {
@carlessanagustin
carlessanagustin / pipeline.yaml
Created September 4, 2020 08:58
Azure Devops Pipeline predefined variables print
trigger:
branches:
include:
- master
- develop
- refs/tags/*
pool:
vmImage: 'ubuntu-18.04'
@asabaylus
asabaylus / gist:3071099
Created July 8, 2012 14:12
Github Markdown Heading Anchors

Anchors in Markdown

To create an anchor to a heading in github flavored markdown. Add - characters between each word in the heading and wrap the value in parens (#some-markdown-heading) so your link should look like so:

[create an anchor](#anchors-in-markdown)

@aristidesneto
aristidesneto / change_password
Created August 22, 2018 15:13
Alterar senha de root do MariaDB
Após instalar o MariaDB você consiga entrar no banco de dados sem senha ou mesmo digitando qualquer senha ele entra, faça os passos a seguir para resolver esse problema.
1 - Conectar no banco:
sudo mysql -u root
2 - Consultar usuário cadastrados na tabela user
SELECT user, host FROM mysql.user;
+------------------+-----------+
| User | Host |
@bespokoid
bespokoid / linux_wifi_setup.md
Created October 13, 2019 21:14
Connecting to wifi network through command line #linux #cmd

Connecting to wifi network through command line

I am trying to connect to my WEP network just using the command-line (Linux).

I run:

sudo iwconfig wlan0 mode Managed essid 'my_network' key 'xx:xx:... hex key, 26 digits'

Then I try to obtain an IP with