Skip to content

Instantly share code, notes, and snippets.

View mgmgpyaesonewin's full-sized avatar
🐒
coding

Pyae Sone Win mgmgpyaesonewin

🐒
coding
View GitHub Profile
@Widdershin
Widdershin / ssr.md
Last active May 1, 2024 17:36
The absurd complexity of server-side rendering

In the olden days, HTML was prepared by the server, and JavaScript was little more than a garnish, considered by some to have a soapy taste.

After a fashion, it was decided that sometimes our HTML is best rendered by JavaScript, running in a user's browser. While some would decry this new-found intimacy, the age of interactivity had begun.

But all was not right in the world. Somewhere along the way, we had slipped. Our pages went uncrawled by Bing, time to first meaningful paint grew faster than npm, and it became clear: something must be done.

And so it was decided that the applications first forged for the browser would also run on the server. We would render our HTML using the same logic on the server and the browser, and reap the advantages of both worlds. In a confusing series of events a name for this approach was agreed upon: Server-side rendering. What could go wrong?

In dark rooms, in hushed tones, we speak of colours.

@azagniotov
azagniotov / beautiful.rest.api.docs.in.markdown.md
Last active May 6, 2024 01:05
Example to create beautiful REST API docs in Markdown, inspired by Swagger API docs.
@kentcdodds
kentcdodds / package.json
Last active March 6, 2024 01:37
Validates that the versions of tools specified in `engines` in the package.json are installed on the machine.
{
"name": "workshop-computer-validator",
"version": "1.0.0",
"description": "I use this to validate people's computers have the proper versions of node and npm installed for a workshop",
"bin": "./validate-system.js",
"dependencies": {
"semver": "7.1.3"
}
}
@diachedelic
diachedelic / deep-link-from-browser.js
Last active April 28, 2024 12:51
Deep link to a native app from a browser, with a fallback
@Mau5Machine
Mau5Machine / docker-compose.yml
Last active April 9, 2024 16:00
Traefik Configuration and Setup
version: "3.3"
services:
################################################
#### Traefik Proxy Setup #####
###############################################
traefik:
image: traefik:v2.0
restart: always

Naming Controllers

Controllers should be in singular case, no spacing between words, and end with "Controller".

Also, each word should be capitalised (i.e. BlogController, not blogcontroller).

For example: BlogController, AuthController, UserController.

Bad examples: UsersController (because it is in plural), Users (because it is missing the Controller suffix).
@vicgonvt
vicgonvt / deployment_guide.md
Last active March 17, 2024 06:51
Deployment Guide for Ubuntu Server from Scratch with Laravel
# tested on mac
server {
server_name main-app.dev;
root /var/www/projects/main/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
@jidolstar
jidolstar / ChCrypto.java
Last active February 26, 2024 16:04
AES 256 encrypt / decrypt - JAVA, PHP, Kotlin
package chela.spring.core;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.util.Base64;
final public class ChCrypto {
final static Base64.Encoder encorder = Base64.getEncoder();
final static Base64.Decoder decorder = Base64.getDecoder();