Git
Making a repo from scratch
When ever I start a new repo, I swear getting github to push the directory from my local is a pain
-
Go to gitub, make a fresh repo, dont add a readme, dont add a license, you can add those things later
-
Uplaod local directory as first commit
- Follow steps 2.1 - 2.6 in right side panel
Readme Template
You can configure the project by editing the configuration files:
// next.config.mjs
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
images: {
domains: ['images.unsplash.com'],
},
};
export default nextConfig;
code
What license to pick
Here's an example of using components from the project:
// Example component usage
import { Button } from '@/components/ui/button';
export default function MyComponent() {
return (
<div className="container mx-auto px-4 py-8">
<h1 className="text-3xl font-bold mb-4">Welcome to the App</h1>
<Button variant="default">Get Started</Button>
<Button variant="outline" className="ml-2">Learn More</Button>
</div>
);
}
code
Additional Information
For more detailed instructions and troubleshooting tips, refer to our documentation.
git init
code
git add .
code
git commit -m "init commit"
code
git remote add origin git@github.com:jynfairchild/danger_docs.git
code
git branch -M main
code
git push -u origin main
code
Next.js Configuration
// next.config.mjs
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
images: {
domains: ['images.unsplash.com', 'cdn.example.com'],
formats: ['image/avif', 'image/webp'],
},
experimental: {
serverActions: true,
},
async redirects() {
return [
{
source: '/old-page',
destination: '/new-page',
permanent: true,
},
];
},
};
export default nextConfig;
code
Environment Variables
# .env.local example
DATABASE_URL="postgresql://user:password@localhost:5432/mydb"
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your-secret-here"
NEXT_PUBLIC_API_URL="https://api.example.com"
code
Package.json Scripts
{
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"type-check": "tsc --noEmit",
"test": "jest",
"test:watch": "jest --watch",
"e2e": "cypress open",
"e2e:headless": "cypress run"
}
}
code
My favorite nvim remaps
-- visual move up and down, highlight brakets
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
-- Window resize in normal mode with incremental changes
vim.keymap.set("t", "<kMinus>", "<C-\\><C-n>:resize -8<CR>i")
vim.keymap.set("t", "<kPlus>", "<C-\\><C-n>:resize +8<CR>i")
vim.keymap.set("t", "<k7>", "<C-\\><C-n>:vertical resize +10<CR>i")
vim.keymap.set("t", "<k8>", "<C-\\><C-n>:vertical resize -10<CR>i")
vim.keymap.set("n", "<k7>", ":vertical resize -10<CR>")
vim.keymap.set("n", "<k8>", ":vertical resize +10<CR>")
vim.keymap.set("n", "<kMinus>", ":resize -8<CR>")
vim.keymap.set("n", "<kPlus>", ":resize +8<CR>")
-- terminal
vim.keymap.set("n", "<leader>th", function() require("nvterm.terminal").toggle('horizontal') end)
vim.keymap.set("n", "<leader>tv", function() require("nvterm.terminal").toggle('vertical') end)
vim.keymap.set("n", "<f6>", "<C-w><Right><C-w><Down><Up>")
vim.keymap.set("t", "<f5>", "<C-\\><C-n><C-w><Left>")
-- Mapping to run reload maps
vim.keymap.set('n', '<leader>;r', function()
vim.cmd('luafile ~/.config/nvim/lua/dangercat/remap.lua')
end, { noremap = true, silent = false, desc = "reload remaps" })
-- Mapping to run reload sets
vim.keymap.set('n', '<leader>;s', function()
vim.cmd('luafile ~/.config/nvim/lua/dangercat/set.lua')
end, { noremap = true, silent = false, desc = "reload sets" })
-- Mapping to run PackerSync
vim.keymap.set('n', '<leader>;p', function()
vim.cmd [[:PackerSync]]
end, { noremap = true, silent = false, desc = "PackerSync" })
code