Skip to content

Instantly share code, notes, and snippets.

View bartoszgolebiowski's full-sized avatar

Bartosz Golebiowski bartoszgolebiowski

  • Gliwice
View GitHub Profile

VIM 101

  • Create or open file: vi <filename>
  • Normal mode: ESC | Insert mode: i | Command mode: : In normal mode, we can execute Vim commands to search, and transform text. In Insert mode, we can edit the file content.
  • Write and quit: :wq
  • Select lines: Press v to start visual selection. Select lines with arrow keys.
  • Copy with y | Paste with p 
  • Delete or cut line: d 
  • Repeat last action: . Press dot as many times as you want to repeat the command (e.g. indent)
  • Search: / E.g. /nodePort
@gaearon
gaearon / 00-README-NEXT-SPA.md
Last active April 25, 2025 13:14
Next.js SPA example with dynamic client-only routing and static hosting

Next.js client-only SPA example

Made this example to show how to use Next.js router for a 100% SPA (no JS server) app.

You use Next.js router like normally, but don't define getStaticProps and such. Instead you do client-only fetching with swr, react-query, or similar methods.

You can generate HTML fallback for the page if there's something meaningful to show before you "know" the params. (Remember, HTML is static, so it can't respond to dynamic query. But it can be different per route.)

Don't like Next? Here's how to do the same in Gatsby.

@DavidWells
DavidWells / javascript-proxy-as-rest-client.js
Last active May 12, 2024 14:24
Using a javascript proxy as low code REST client
/* Using a JavaScript proxy for a super low code REST client */
// via https://dev.to/dipsaus9/javascript-lets-create-aproxy-19hg
// also see https://towardsdatascience.com/why-to-use-javascript-proxy-5cdc69d943e3
// also see https://github.com/fastify/manifetch
// also see https://github.com/flash-oss/allserver
// and https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb
const createApi = (url) => {
return new Proxy({}, {
get(target, key) {
@igoro00
igoro00 / Chakra-UI x React-datepicker.md
Last active December 22, 2024 23:39 — forked from baumandm/Chakra-UI x React-datepicker.md
Chakra-UI x React-datepicker

Tiny wrapper component for React-Datepicker to stylistically fit with Chakra-UI 1.x.

<DatePicker selectedDate={myDate} onChange={(d) => console.log(d)} />

Clearable version:

<DatePicker selectedDate={myDate} onChange={(d) => console.log(d)} isClearable={true} />
@nerycordova
nerycordova / lambda.js
Last active March 14, 2024 18:10
Unzip large files in AWS S3 using Lambda and Node.js
//Dev.to article: https://dev.to/nerycordova/unzip-large-files-in-aws-using-lambda-and-node-js-cpp
const AWS = require("aws-sdk");
const s3 = new AWS.S3({ apiVersion: "2006-03-01" });
const unzipper = require("unzipper");
exports.handler = async (event) => {
//...initialize bucket, filename and target_filename here
try {
@pmuellr
pmuellr / zod+js+jsdoc.js
Created October 31, 2020 16:04
trying to use zod in js with jsdoc type comments for vs code - almost works!
'use strict'
// examples from https://github.com/vriad/zod
// trying to use zod in JS w/ jsdoc type comments in vsCode
const z = require('zod')
const dogSchema = z.object({
name: z.string(),
@rupeshtiwari
rupeshtiwari / Setting up Webpack for Typescript Project From Scratch.md
Last active April 11, 2025 13:57
Setting up Webpack for Typescript Project From Scratch

Setting up Webpack for any Typescript project from Scratch

Welcome to step by step hands-on guide to setup webpack in your upcoming typescript project. Please follow the steps and you should be able to create your own webpack project. Please download the source code from github.

You will learn below things:

  1. ✅Create a Typescript node.js project.
  2. ✅Install Dependencies with webpack & typescripts.
  3. ✅Use Webpack CLI to crate webpack.config.js file and modify webpack.config.js based on our need.
@markerikson
markerikson / redux-socket-middleware-example.js
Created June 28, 2018 00:37
Redux socket middleware example usage
const createMySocketMiddleware = (url) => {
return storeAPI => {
let socket = createMyWebsocket(url);
socket.on("message", (message) => {
storeAPI.dispatch({
type : "SOCKET_MESSAGE_RECEIVED",
payload : message
});
});
@fokusferit
fokusferit / enzyme_render_diffs.md
Last active April 23, 2025 17:13
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@ericelliott
ericelliott / essential-javascript-links.md
Last active March 22, 2025 17:28
Essential JavaScript Links