Underscore example:
_.each([1, 2, 3], function(num) { alert(num); });
# ============== shell | |
# Case-insensitive globbing. | |
shopt -s nocaseglob; | |
# Do not overwrite files when redirecting using ">", ">&" or "<>". | |
# Note that you can still override this with ">|". | |
set -o noclobber; | |
# UTF-8 all the way. | |
export LC_ALL='en_GB.UTF-8'; |
var svg = document.getElementById('graph'), | |
xml = new XMLSerializer().serializeToString(svg), | |
data = "data:image/svg+xml;base64," + btoa(xml), | |
img = new Image() | |
img.setAttribute('src', data) | |
document.body.appendChild(img) |
I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
/*! | |
* tableToD3Chart(); | |
* Author: Joe Watkins - joe@emergeinteractive.com | |
* | |
* Scrape the dom for data and create C3/D3 based charts | |
* | |
* Defaults: | |
* chartTitleWrapper = the element wrapping text for chart label | |
* chartType = line, pie, donut, bar, spline, scatter etc. - see C3 docs | |
* useDom = true/false - if you don't want to scrape dom and want to define data use false |
#!/bin/sh | |
PROJECT=`php -r "echo dirname(dirname(dirname(realpath('$0'))));"` | |
STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php` | |
# Determine if a file list is passed | |
if [ "$#" -eq 1 ] | |
then | |
oIFS=$IFS | |
IFS=' |
Example:
zsh-5.7.1-1-x86_64.pkg.tar.xz
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.