Skip to content

Instantly share code, notes, and snippets.

View khu-md's full-sized avatar
🏠
Working from home

khu-md

🏠
Working from home
View GitHub Profile
/**
* Service Worker
*
* Globals
* - CACHE_NAME - usually an app name with a version number
* important for opening up the cache available to service workers
* - urlsToCache - usually an array of URIs corresponding to
* the requests whose responses the service worker should cache
*/
@khu-md
khu-md / index.js
Created October 29, 2020 02:15
Register a service worker
// Client-side JavaScript can change element colors
const title = document.getElementById("title");
title.style.color = "blue";
// It can also register a service worker.
/**
* REGISTRATION
*
* tests for if navigator even has serviceWorker API
@khu-md
khu-md / markdown-details-collapsible.md
Created October 14, 2020 10:20 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

A collapsible section containing markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets
Neo4j install OS X
$ brew install neo4j
To have launchd start neo4j now and restart at login:
brew services start neo4j
Or, if you don't want/need a background service you can just run:
neo4j start
DB Folder
@khu-md
khu-md / macos-tmux-256color.md
Last active September 28, 2020 01:04 — forked from bbqtd/macos-tmux-256color.md
Installing tmux-256color for macOS

Installing tmux-256color for macOS

  • macOS 10.15.5
  • tmux 3.1b

macOS has ncurses version 5.7 which does not ship the terminfo description for tmux. There are two ways to address this.

The Fast Blazing Solution

Instead of tmux-256color, use screen-256color. Place into ~/.tmux.conf or ~/.config/tmux/tmux.conf(for version 3.1 and later) the following:

@khu-md
khu-md / .tmux.conf
Created September 8, 2020 14:30 — forked from william8th/.tmux.conf
Tmux open new pane in same directory
set -g prefix C-a
unbind-key C-b
bind-key C-a send-prefix
bind c new-window -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
@khu-md
khu-md / docker-rm-images.md
Created August 28, 2020 14:15 — forked from alferov/docker-rm-images.md
Remove all (untagged) images and containers from Docker
# Delete all containers
docker rm $(docker ps -aq)
# Delete all images
docker rmi $(docker images -q)
# Delete all untagged images
docker rmi $(docker images -q --filter "dangling=true")

References:

@khu-md
khu-md / Rails DockerFile
Created August 28, 2020 14:11 — forked from colby-swandale/Rails DockerFile
Dockerfile with rbenv and ruby-install
FROM ubuntu:latest
MAINTAINER Colby Swandale <colby@taplaboratories.com.au>
# update apt cache and install dependencies
RUN apt-get update && apt-get install git curl build-essential libssl-dev libreadline-dev zlib1g-dev sqlite3 libsqlite3-dev -y
# add app user
RUN adduser --gecos '' --disabled-password app
# set user to app
USER app
# set rbenv, ruby-build bin paths
ENV HOME /home/app