Skip to content

Instantly share code, notes, and snippets.

View akosasante's full-sized avatar

Akosua akosasante

View GitHub Profile
@PJUllrich
PJUllrich / big-o.md
Last active April 28, 2024 14:19
Big-O Time Complexities for Elixir Data Structures

Big-O Time Complexities for Elixir data structures

Map [1]

Operation Time Complexity
Access O(log n)
Search O(log n)
Insertion O(n) for <= 32 elements, O(log n) for > 32 elements [2]
Deletion O(n) for <= 32 elements, O(log n) for > 32 elements
@codejedi365
codejedi365 / README.md
Last active January 8, 2024 11:19
Configuring Typescript project with `ts-jest` & `jest-extended`

TS-JEST & JEST-EXTENDED SUPPORT

This gist is designed to explain how to configure a project where you have your test code separated from your codebase. The project file structure looks a bit like this:

project
├─┬ lib                    # could be src
│ ├── globals.d.ts         # source code specific type declarations
│ └── index.ts
├─┬ tests

ZSH CheatSheet

This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.

Strings

Description Syntax
Get the length of a string ${#VARNAME}
Get a single character ${VARNAME[index]}
@danopia
danopia / Dockerfile
Last active May 2, 2024 18:30
ERCOT Frozen Grid 2021 - Metrics Reporters
FROM hayd/alpine-deno:1.10.1
WORKDIR /src/app
ADD deps.ts ./
RUN ["deno", "cache", "deps.ts"]
ADD *.ts ./
RUN ["deno", "cache", "mod.ts"]
ENTRYPOINT ["deno", "run", "--unstable", "--allow-net", "--allow-hrtime", "--allow-env", "--cached-only", "--no-check", "mod.ts"]
@amattn
amattn / Dockerfile
Created January 6, 2021 17:44
Dockerfile example used to build an elixir/phoenix project on linux and output a tarball
FROM elixir:1.11.2 AS build
## instll some dependencies (webpack basically)
RUN \
apt-get update -y && \
curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
apt-get install -y nodejs && node -v && npm -v
# Required environment variables passed in via --build-arg flags
@amattn
amattn / deploy.sh
Last active September 9, 2023 05:41
#!/bin/sh
set -o nounset
set -o errexit
usage(){
echo "Usage: $0 X.Y.Z dev|test|staging|prod"
echo ""
echo "example: ./deploy.sh 1.1.3 prod"
echo "example: ./deploy.sh 1.2.0 dev"
name: Elixir CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
MIX_ENV: test
@bradwestfall
bradwestfall / HoC-vs-RenderProps-vs-Hooks.md
Last active May 16, 2024 12:57
An explanation of why Hooks are a nicer way to abstract re-useable state and functionality vs HoC's and Render Props

HoC (pattern) vs Render Props (pattern) vs Hooks (not pattern, a new API)

Someone was asking me about comparing the HoC and Render Props patterns (and their shortcomings) to hooks. I might leave this up as a public gist for others if it's helpful.


tldr;

Issues with HoC:

@thiagosf
thiagosf / gist:eb2ba7d24968873e745c61d2ee72c0d8
Last active September 25, 2023 10:44
Export ERD (diagrams) from SequelPro

Export ERD (diagrams) from SequelPro

Install graphviz

sudo brew install graphviz

Open SequelPro, choose database and export dot file. Now, run the command:

@DevoKun
DevoKun / kafka.md
Created July 13, 2018 02:52
How to operate Kafka, mostly using Docker

Kafka Distributed Streaming Platform

Publish and Subscribe / Process / Store

Start Kafka

  • Kafka uses ZooKeeper as a distributed backend.

Start Zookeeper