Skip to content

Instantly share code, notes, and snippets.

@wojteklu
wojteklu / clean_code.md
Last active May 21, 2024 17:31
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

@rphlmr
rphlmr / helpers.ts
Last active May 21, 2024 17:30
Drizzle ORM, deep sub queries
/* -------------------------------------------------------------------------- */
/* More here; */
/* -------------------------------------------------------------------------- */
//gist.github.com/rphlmr/0d1722a794ed5a16da0fdf6652902b15
https: export function distinctOn<Column extends AnyColumn>(column: Column) {
return sql<Column["_"]["data"]>`distinct on (${column}) ${column}`;
}
export function jsonBuildObject<T extends SelectedFields>(shape: T) {
@realvjy
realvjy / ChoasLinesShader.metal
Last active May 21, 2024 17:30
Choas Lines - Metal Shader
// Lines
float hash( float n ) {
return fract(sin(n)*753.5453123);
}
// Slight modification of iq's noise function.
float noise(vector_float2 x )
{
vector_float2 p = floor(x);
vector_float2 f = fract(x);
@trngbich
trngbich / Merge_Zotero_duplicates
Last active May 21, 2024 17:29
merge duplicates in Zotero. Open Zotero > select 'Duplicate Items' > select first item > select first version > Open 'Developer/Run Javascript' > copy and paste > Run. Source: https://forums.zotero.org/discussion/40457/merge-all-duplicates.
// By: marcelparciak
var DupPane = Zotero.getZoteroPanes();
for(var i = 0; i < 100; i++) {
await new Promise(r => setTimeout(r, 1000));
DupPane[0].mergeSelectedItems();
Zotero_Duplicates_Pane.merge();
}
@leeuwd
leeuwd / setup-ubuntu-akeneo-pim.md
Last active May 21, 2024 17:29
How to setup an Ubuntu server (i.e. DigitalOcean LAMP stack droplet) Akeneo PIM server.

How to setup the Akeneo server

# date: january 2018
# author: Dick de Leeuw (dick@leeuw.studio, @leeuwd)
# prerequisites: LAMP droplet (>= 8GB RAM)
# environment: Ubuntu 16.04.3 LTS xenial, Apache/2.4.29 (Ubuntu), MySQL 5.7.21 & PHP 7.1

# create droplet
@FlorianWolters
FlorianWolters / CMakeLists.txt
Last active May 21, 2024 17:29
Add Boost C++ Libraries as a dependency with plain CMake
# Copyright (c) 2014-2023 Florian Wolters
# MIT License
cmake_minimum_required(VERSION 3.26.3)
project(
"hello_boost_with_cmake"
VERSION 2.0.0
LANGUAGES CXX)
@leftmove
leftmove / chat.py
Created May 21, 2024 11:59
Gemini API Command Line Chat Bot
import os
import json
from datetime import datetime
from dotenv import load_dotenv
from colorama import Fore, Back, Style
load_dotenv()
import google.generativeai as genai
@theprojectsomething
theprojectsomething / Firefox Pretty Tree Style Tab.md
Last active May 21, 2024 17:27
Tree Style Tab: Sliding sidebar / pinned + active tabs

Firefox pretty sliding sidebar / pinned / active tab theme for Tree Style Tab

Features

  • Auto-sliding draw for TST
  • Leaves 'pinned' and 'active' tabs visible in standard browser chrome
  • Leaves 'last-active' tabs visible for 3 minutes after becoming inactive
  • Where an active tab is pinned, leaves 'last-active' tab (x1) visible for 1hr

tree-style-tabs-theme

@binho
binho / caixa_modulo_seguranca_macOS.md
Last active May 21, 2024 17:27
Como instalar/reinstalar o módulo de segurança da Caixa no macOS

Bom vou falar um pouco da minha luta com o Internet Banking da Caixa.

No meu caso tive problemas após migrar o meu macbook para um novo e não conseguia instalar o módulo de segurança no novo macbook e assim sem poder usar o Internet Banking no computador.

Primeiro rodei o script sudo /usr/local/bin/warsaw/uninstall.sh do warsaw como root pra tentar começar tudo do zero mas ainda assim após tentar reinstalar não tive sucesso.

Ao analisar o script postinstall dentro do pkg notei que varios arquivos de inicialização são criados e que alguns dados ainda continuaram no meu computador como certificados e arquivos de inicialização, então tenha certeza que estes arquivos abaixo tenham sido removidos:

rm -f ~/Library/LaunchAgents/com.diebold.warsaw.user.plist