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
| # change directory to any parent | |
| # instead of writing "cd ../" you can write: | |
| # $ u | |
| # instead of writing "cd ../../" you can write: | |
| # $ u 2 | |
| # instead of writing "cd ../../../../../../../../../../" you can write: | |
| # $ u 10 |
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
| export type Result<T, E = undefined> = { ok: true; value: T } | { ok: false; error: E | undefined } | |
| export const Ok = <T>(data: T): Result<T, never> => ({ ok: true, value: data }) | |
| export const Err = <E>(error?: E): Result<never, E> => ({ ok: false, 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
| #!/bin/bash | |
| # To kill http://localhost:3333, http://localhost:8080, http://localhost:5000, etc. | |
| # Run `$ kill-ports.sh 3333 8080 5000` | |
| for port in "$@"; do | |
| lsof -ti tcp:"$port" | xargs kill | |
| done |
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 | |
| # Here is a shell script that deletes the node_modules folder from each folder found in the current working directory: | |
| # Deletes one level down, no recursion | |
| # Run this to allow deletion: | |
| # $ chmod +x./delete_node_modules.sh | |
| # Run this to delete: | |
| # $ ./delete_node_modules.sh |
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
| @keyframes border-dance { | |
| 0% { | |
| background-position: left top, right bottom, left bottom, right top; | |
| } | |
| 100% { | |
| background-position: left 15px top, right 15px bottom, left bottom 15px, | |
| right top 15px; | |
| } | |
| } |
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
| // you might have to do something in webpack to enable wasm/photon | |
| import initPhoton, { | |
| resize as photon__resize, | |
| open_image as photon__open_image, | |
| putImageData as photon__put_image_data, | |
| } from "photon-web" | |
| const image = ref<HTMLImageElement>() | |
| const imageUpload = ref<HTMLInputElement>() | |
| const storageImageUrl = ref("") |
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 { round } from ".." | |
| /** | |
| * @example | |
| * | |
| * ```ts | |
| * const fees = new PaymentAmount(1000) | |
| * fees.getAmountToUser() // === 976.66 | |
| * fees.getAmountToStripe() // === 21 | |
| * ``` |
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
| <script> | |
| import { useStore } from './store' | |
| import { storeActionTimer } from './helpers' | |
| const store = useStore() | |
| store.$onAction(storeActionTimer) | |
| </script> |
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
| const arr = [8, 2, 5, 3, 0] | |
| arr.sort((a, b) => { | |
| // -1 sorts up | |
| if (a > b) return -1 | |
| // 1 sorts down | |
| else if (a < b) return 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
| // use con.log("poop") to console.log "poop" in development | |
| // or con.stagingLog("poop") to console.log "poop" in staging | |
| // or con.prodLog("poop") to console.log "poop" in production | |
| export default { | |
| isDev() { | |
| return process.env.NODE_ENV === "development" | |
| }, | |
| isStaging() { | |
| return process.env.NODE_ENV === "staging" |
NewerOlder