Skip to content

Instantly share code, notes, and snippets.

@nilsandrey
nilsandrey / instructions.md
Created May 5, 2021 — forked from matthewjberger/instructions.md
Install a nerd font on ubuntu
View instructions.md

1.) Download a Nerd Font

2.) Unzip and copy to ~/.fonts

3.) Run the command fc-cache -fv to manually rebuild the font cache

View rails_generator_cheat_sheet.md

Cheat Sheets are greate but they are not a substitute for learning the framework and reading the documentation as we most certainly have not covered every potential example here. Please refer to the Rails Command Line Docs for more information.

Command Line Generator Info

Reference

You can get all of this information on the command line.

rails generate with no generator name will output a list of all available generators and some information about global options. rails generate GENERATOR --help will list the options that can be passed to the specified generator.

@nilsandrey
nilsandrey / docker-fixports.ps1
Last active May 4, 2021
Workaround for Unable to bind ports: Docker-for-Windows & Hyper-V. https://github.com/docker/for-win/issues/3171
View docker-fixports.ps1
# 1. Disable hyper-v (which will required a couple of restarts)
dism.exe /Online /Disable-Feature:Microsoft-Hyper-V
# 2. When you finish all the required restarts, reserve the port you want so hyper-v doesn't reserve it back
# Notice: Include the port number is failing to you...50051 on sample...
netsh int ipv4 add excludedportrange protocol=tcp startport=50051 numberofports=1
# 3. Re-Enable hyper-V (which will require a couple of restart)
dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All
View animate-focus.css
@media
(prefers-reduced-motion: no-preference) {
:focus {
transition: outline-offset .25s ease;
outline-offset: 5px;
}
}
View boilerplate.html
<!-- Line by line explanation: https://www.matuzo.at/blog/html-boilerplate/ -->
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>Unique page title - My Site</title>
<script type="module">
@nilsandrey
nilsandrey / index.html
Created Apr 4, 2021
Scriptless HTML Menu
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="initial-scale=1.0" />
<title>Document</title>
<link href="style.css" rel="stylesheet">
</head>
<body>
<input type="checkbox" id="menu-toggle" />
@nilsandrey
nilsandrey / install-node-14-ubuntu.sh
Created Mar 16, 2021
NodeSource Node.js Binary Distribution: v14 in Ubuntu
View install-node-14-ubuntu.sh
# Using Ubuntu
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
@nilsandrey
nilsandrey / daemon.json
Last active Mar 16, 2021
Docker daemon can be set up to forward the logs to Syslog, which then logs into messages or a separate file if you configure Syslog correctly. (On CentOS7) Change your /etc/docker/daemon.json to something like this, and then restart docker daemon https://www.reddit.com/r/docker/comments/m63noe/how_can_i_store_docker_logs_to_a_file_real_time/gr3t…
View daemon.json
{
"log-driver": "syslog",
"log-opts": {
"tag": "dockerlogs {{.Name}}/{{.ID}}"
}
}
View mock-pipe.ts
// If you want reusable util function for mocking pipes, you can try this option:
export function mockPipe(options: Pipe): Pipe {
const metadata: Pipe = {
name: options.name
};
return <any>Pipe(metadata)(class MockPipe {});
}