Skip to content

Instantly share code, notes, and snippets.

@dre1080
dre1080 / 1_searchbar_live.ex
Created June 8, 2023 03:23 — forked from caspg/1_searchbar_live.ex
Example of real-time search bar implementation in Phoenix LiveView and Tailwind. Working example on https://travelermap.net/parks/usa
defmodule TravelerWeb.SearchbarLive do
use TravelerWeb, :live_view
alias Phoenix.LiveView.JS
alias Traveler.Places
def mount(_params, _session, socket) do
socket = assign(socket, places: [])
{:ok, socket, layout: false}
end
@dre1080
dre1080 / git-lfs-example.sh
Created May 30, 2023 08:08 — forked from MichaelCurrie/git-lfs-example.sh
Use git-lfs on existing repository
# Install git-lfs
# (From https://github.com/git-lfs/git-lfs/wiki/Installation)
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs
git lfs install
# Add git-lfs to an existing repo
@dre1080
dre1080 / docker-cleanup-resources.md
Created November 9, 2020 23:18 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@dre1080
dre1080 / config.yml
Last active October 20, 2020 00:36 — forked from Surendrajat/config.yml
fusuma multitouch gesture config for elementary OS
swipe:
3:
left:
command: 'xdotool key ctrl+super+Left'
right:
command: 'xdotool key ctrl+super+Right'
up:
command: 'xdotool key ctrl+t'
threshold: 1.5
down:
@dre1080
dre1080 / fix.md
Created October 19, 2020 18:57
megasync fix for deepin OS v20

you can fix this by adding the env variable in the launch file:

nano /usr/share/applications/megasync.desktop

and then replace Exec=megasync with Exec=env QT_SCALE_FACTOR=1 megasync

remove the TryExec line and save. you can then copy the megasync.desktop launch file to your autostart folder, e.g.:

@dre1080
dre1080 / .dotfiles
Last active January 12, 2023 05:12
my dotfiles
my dotfiles
@dre1080
dre1080 / Dockerfile
Created October 23, 2019 21:26
Nuxt.js Multi-Stage Dockerfile
# Build
FROM node:latest as build-env
ENV NODE_ENV production
WORKDIR /src
COPY . .
RUN yarn install \

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@dre1080
dre1080 / deploy.sh
Created October 29, 2018 14:09
Zero Downtime Docker Compose Deploys
#!/usr/bin/env bash
CONTAINER_NAME="$1"
PROJECT_NAME="app"
# lets find the first container
FIRST_NUM=`docker ps | awk '{print $NF}' | grep app_$CONTAINER_NAME | awk -F "_" '{print $NF}' | sort | head -1`
NUM_OF_CONTAINERS=1
MAX_NUM_OF_CONTAINERS=2