This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| Ref: https://jonasjancarik.medium.com/handling-those-unhandled-promise-rejections-when-using-javascript-async-await-and-ifee-5bac52a0b29f | |
| Placement of catch BEFORE and AFTER then: https://stackoverflow.com/questions/42013104/placement-of-catch-before-and-after-then | |
| */ | |
| // 1. Work | |
| (async()=>{ | |
| return Promise.reject("a").catch((_error) =>{}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule ModuleToBeUsed do | |
| defmacro __using__(_) do | |
| IO.puts __MODULE__ # COMPILATION STAGE | |
| quote do # needed to prevent execution on compilation stage | |
| IO.inspect(__MODULE__, label: "__MODULE__") | |
| IO.inspect(unquote(__MODULE__), label: "unquote(__MODULE__)") | |
| import unquote(__MODULE__) | |
| def test, do: IO.puts "I am test" # EXECUTION STAGE | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Initialize MySQL database. | |
| # ADD this file into the container via Dockerfile. | |
| # Assuming you specify a VOLUME ["/var/lib/mysql"] or `-v /var/lib/mysql` on the `docker run` command… | |
| # Once built, do e.g. `docker run your_image /path/to/docker-mysql-initialize.sh` | |
| # Again, make sure MySQL is persisting data outside the container for this to have any effect. | |
| set -e | |
| set -x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sqlalchemy import (String, | |
| Integer, | |
| engine_from_config, | |
| Column) | |
| from sqlalchemy.ext.declarative import declarative_base | |
| from sqlalchemy.orm import sessionmaker | |
| Base_1 = declarative_base() | |
| Base_2 = declarative_base() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "repository": {}, | |
| "description": " ", | |
| "license": "MIT", | |
| "scripts": { | |
| "deploy": "webpack --mode production", | |
| "watch": "webpack --mode development --watch" | |
| }, | |
| "dependencies": { | |
| "@tailwindcss/forms": "^0.2.1", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done | |
| git fetch --all | |
| git pull --all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as React from "react"; | |
| import { FC, useEffect } from "react"; | |
| import { BulkDeleteButton, BulkExportButton, Loading } from "react-admin"; | |
| import { useSelector } from "react-redux"; | |
| import { useQuery } from "react-query"; | |
| import { reservationAPI } from "@/api"; | |
| import { ReservationStatus } from "@/utils/typing/reservation"; | |
| import { GetListResult } from "ra-core/esm/types"; | |
| import { forkJoin, from, Observable, of } from "rxjs"; | |
| import { csDataProvider, User } from "@/utils"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from "react"; | |
| import logo from "./logo.svg"; | |
| import { useState } from "react"; | |
| import "./App.css"; | |
| function App() { | |
| const [number, setNumber] = useState(); | |
| const highestPrime = (num: number) => { | |
| for (let i = num; i > 2; i--) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pylint --rcfile=.pylintrc backend/**/*.py -r y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ref: | |
| # https://wiki.openssl.org/index.php/Command_Line_Elliptic_Curve_Operations | |
| # https://stackoverflow.com/questions/15686821/generate-ec-keypair-from-openssl-command-line | |
| # openssl ec help | |
| # 1.1 generate private key in EC format: | |
| openssl ecparam -name secp384r1 -genkey -noout -out auth-private.ec.key | |
| # 1.2 convert EC format to a non-encrypted PKCS8 format: | |
| openssl pkcs8 -topk8 -nocrypt -in auth-private.ec.key -out auth-private.pem |