Skip to content

Instantly share code, notes, and snippets.

View al3rez's full-sized avatar

Alireza Bashiri al3rez

View GitHub Profile
@al3rez
al3rez / linux-setup.sh
Created April 26, 2024 20:22 — forked from dhh/linux-setup.sh
linux-setup.sh
# CLI
sudo apt update -y
sudo apt install -y \
git curl docker.io \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
libvips imagemagick libmagickwand-dev \
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \
rbenv apache2-utils
@al3rez
al3rez / clear-db.ts
Created April 20, 2024 19:24 — forked from rphlmr/clear-db.ts
Drizzle snippets
// Credits to Louistiti from Drizzle Discord: https://discord.com/channels/1043890932593987624/1130802621750448160/1143083373535973406
import { sql } from "drizzle-orm";
const clearDb = async (): Promise<void> => {
const query = sql<string>`SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'public'
AND table_type = 'BASE TABLE';
`;
@al3rez
al3rez / 01_schema.sql
Last active January 29, 2020 09:13 — forked from vadv/01_schema.sql
/* list of order */
create table "order" (
id text primary key,
created_at timestamp with time zone default current_timestamp,
processed_at timestamp with time zone,
processed_state text
);
/* processed transition on order.id */
create table order_events (
# Given a user containing a `first_name` and a `last_name` methods, write a `handle`
# method that returns a generated handle that follow the following rules:
# - It must be preceded by an @
# - It must be all lowercase
# - It contains the first letter of the first name, and all the letters of the last
# name (for "John" "Doe", it'd be @jdoe)
# - If the first name contains more than one name, get the first letter of each name
# ("John Fitzgerald Wood" "Doe" becomes @jfwdoe)
# - If the last name contains more than one name, get all the letters of the last one,
# and the first letter of each other ("John" "Fitzgerald Wood Doe" becomes @jfwdoe)
@al3rez
al3rez / js.vim
Created January 1, 2016 21:40 — forked from lukaszkorecki/js.vim
" replace 'function' with λ
au BufNewFile,BufRead *.js syntax keyword javasScriptFunction function conceal cchar=λ
au BufNewFile,BufRead *.js hi! link javasScriptFunction Conceal
au BufNewFile,BufRead *.js setlocal conceallevel=2
" add abbreviations for JS
" f_
" expands to
" function() {
" <cursor>
"
@al3rez
al3rez / comma-first-var.js
Created November 20, 2015 07:45 — forked from isaacs/comma-first-var.js
A better coding convention for lists and object literals in JavaScript
// See comments below.
// This code sample and justification brought to you by
// Isaac Z. Schlueter, aka isaacs
// standard style
var a = "ape",
b = "bat",
c = "cat",
d = "dog",