Let's make sure our Express app has the required base modules:
# within root of API
npm install --save express pg knex bcrypt
npm install --save-dev nodemon
{ | |
"name": "sqip-cache-tryout", | |
"version": "1.0.0", | |
"description": "", | |
"main": "", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [], | |
"author": "stefan judis <stefanjudis@gmail.com>", |
apiVersion: batch/v1beta1 | |
kind: CronJob | |
metadata: | |
name: every-5-minutes | |
spec: | |
schedule: "*/5 * * * *" | |
jobTemplate: | |
spec: | |
template: | |
spec: |
import * as React from 'react'; | |
import { hot } from 'react-hot-loader'; | |
import { Provider } from 'react-redux'; | |
import DevTools from '../Devtools'; | |
import configureStore from '../../store/configureStore'; | |
import App from '../App'; | |
import ApplicationState from '../../store/store.types'; | |
import { fetchAuth } from '../../store/common/Auth/Auth'; |
// Feedback requested on the useDeepCompareEffect | |
// it just feels like a bit of work... | |
// HERE'S THE REASON I NEED THIS: | |
// when people use the useQuery hook, they'll typically | |
// do so like this: `useQuery(myQuery, {var1: props.value})` | |
// which means that passing `variables` to `useEffect` will | |
// trigger a rerun of the callback even if they didn't | |
// actually change (referrential equality) | |
function useQuery({query, variables}) { |
{ | |
"lv_module": { | |
"scope": "elixir, html-eex", | |
"prefix": "lv", | |
"body": [ | |
"defmodule ${1}Web.${2}Live do", | |
" use ${1}Web, :live_view", | |
"end" | |
], | |
"description": "LiveView module" |
import type { Action, Loader } from "@remix-run/loader"; | |
import { json, parseFormBody, redirect } from "@remix-run/loader"; | |
import { readTodos, createTodo, deleteTodo } from "../data/todo"; | |
let action: Action = async ({ request, context: { session } }) => { | |
let [method, body] = await methodOverride(request); | |
await new Promise((res) => setTimeout(res, 1000)); | |
switch (method) { | |
case "post": { | |
let [_, error] = await createTodo(body!.name); |
div, span { | |
box-sizing: border-box; | |
position: relative; | |
display: flex; | |
flex-direction: column; | |
align-items: stretch; | |
flex-shrink: 0; | |
align-content: flex-start; |
// This is an advanced example! It is not typically required for application code. | |
// If you are using a library like Redux or MobX, use the container component provided by that library. | |
// If you are authoring such a library, use the technique shown below. | |
// This example shows how to safely update subscriptions in response to props changes. | |
// In this case, it is important to wait until `componentDidUpdate` before removing a subscription. | |
// In the event that a render is cancelled before being committed, this will prevent us from unsubscribing prematurely. | |
// We also need to be careful about how we handle events that are dispatched in between | |
// `getDerivedStateFromProps` and `componentDidUpdate` so that we don't put stale values into the `state`. |
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<title>Twitter Archive Viewer</title> | |
<script>window.YTD = { tweet: {} }</script> | |
<script src="tweet.js"></script><!-- this is loading a file from the archive --> | |
<style> | |
.tweet { border: 1px solid #eee; margin: 8px } | |
.full_text { padding: 8px } | |
.created_at { padding: 8px; color: #777 } | |
</style> |