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/zsh | |
| # Run this from the root of the project!!! | |
| wasm-pack build --target web --release | |
| python fix_package_file.py | |
| cd pkg | |
| npm link |
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
| ## JS Fundamentals | |
| data types | coersion | int vs float, strings, numerics | |
| data structures | classic (array, object) | newer (map, frozen objects) | |
| functions | named, anonymous, lambdas, | |
| prototype | inheritance, this keyword | |
| data types | coercion | int vs float, string numerics | |
| logic expression | |
| regular expressions | |
| date and time | |
| loops |
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.
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 requests | |
| import csv | |
| def get_img(b, sub=''): | |
| image_url = f'https://dog.ceo/api/breed/{b}/{sub}/images/random' if sub else f'https://dog.ceo/api/breed/{b}/images/random' | |
| img_resp = requests.get(image_url) | |
| img_data = img_resp.json()['message'] | |
| return img_data |
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
| # Add spaces between plots | |
| from IPython.core.display import Javascript | |
| # place this after the code that displays the plots | |
| # This code adds a small amount of margin to the bottom of each div that contains a plot image | |
| Javascript('Array.from(document.querySelectorAll(".display_data")).forEach(item => item.style.marginBottom = "1rem")') | |
| # Get the number of missing values group the the number of rows missing the same number of values |
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 google.colab import drive, files | |
| drive.mount('/content/drive') | |
| file_root = '/content/drive/MyDrive/Colab Notebooks/week_3/' | |
| # The command below will list everything in the specified folder. | |
| # Notice the statement converts the python variable into a shell variable if you prepend a "$" | |
| %ls "$file_root" |
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
| function RocketFunc (payloadFunc, payloadParams, payloadContext) { | |
| let launched = false | |
| return (params, override) => { | |
| if (!launched || override) { | |
| launched = true | |
| let parms = params ? params : payloadParams | |
| return payloadFunc.apply(payloadContext, payloadParams) | |
| } | |
| } | |
| } |
Please check here daily as I will try to update this page by noon. I am sharing this outide of social media since thier algorithm tends only to promote selfies or family pictures.
NewerOlder