- Make all parts of Knex TypeScript-safe
import { fromUnixTime, format, getHours } from "date-fns"; | |
import { fromUnixTime, format, getHours } from "date-fns"; | |
const timeSlots = [ | |
{ startTime: 1653998400, endTime: 1654002000 }, //6-31-2022 8am to 6-31-2022 9am | |
{ startTime: 1654002000, endTime: 1654005600 }, //6-31-2022 9am to 6-31-2022 10am | |
{ startTime: 1654012800, endTime: 1654016400 }, //6-31-2022 12pm to 6-31-2022 1pm | |
{ startTime: 1654084864, endTime: 1654088464 }, //2022-06-01 8am to 2022-06-01 9am | |
{ startTime: 1654092064, endTime: 1654095664 }, // 2022-06-01 10am to 2022-06-01 11am | |
{ startTime: 1654106464, endTime: 1654110064 }, // 2022-06-01 2pm to 2022-06-01 3pm |
" Specify a directory for plugins | |
call plug#begin('~/.vim/plugged') | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
Plug 'scrooloose/nerdtree' | |
"Plug 'tsony-tsonev/nerdtree-git-plugin' | |
Plug 'Xuyuanp/nerdtree-git-plugin' | |
Plug 'tiagofumo/vim-nerdtree-syntax-highlight' | |
Plug 'ryanoasis/vim-devicons' | |
Plug 'airblade/vim-gitgutter' |
import { Knex } from 'knex' | |
export async function up(knex: Knex): Promise<any> { | |
await knex.schema.createTable('test_setup', (table: Knex.TableBuilder) => { | |
table.integer('foobar'); | |
}); | |
} | |
export async function down(knex: Knex): Promise<any> { | |
await knex.schema.dropTable('test_setup'); |
function useResponsiveCanvas<T>( | |
initialSize?: MinMaxPair, | |
): State { | |
const canvasRef = useRef<HTMLCanvasElement>(); | |
const mountRef = useRef<HTMLDivElement>(); | |
const [size, setSize] = useState<MinMaxPair>([0, 0]); | |
// set initial svg and size | |
useEffect(() => { | |
const canvas = document.createElement('canvas'); |
cd /home/<user>/ | |
sudo apt-get install unzip | |
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip | |
unzip sdk-tools-linux-4333796.zip -d Android | |
rm sdk-tools-linux-4333796.zip | |
sudo apt-get install -y lib32z1 openjdk-8-jdk | |
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 | |
export PATH=$PATH:$JAVA_HOME/bin | |
printf "\n\nexport JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64\nexport PATH=\$PATH:\$JAVA_HOME/bin" >> ~/.bashrc | |
cd Android/tools/bin |
Download the following repositories and run yarn install
in each:
Migrations are a way to make database changes or updates, like creating or dropping tables, as well as updating a table with new columns with constraints via generated scripts. We can build these scripts via the command line using knex
command line tool.
To learn more about migrations, check out this article on the different types of database migrations!
tl;dr I built a demo illustrating what it might look like to add async rendering to Facebook's commenting interface, while ensuring it appears on the screen simultaneous to the server-rendered story.
A key benefit of async rendering is that large updates don't block the main thread; instead, the work is spread out and performed during idle periods using cooperative scheduling.
But once you make something async, you introduce the possibility that things may appear on the screen at separate times. Especially when you're dealing with multiple UI frameworks, as is often the case at Facebook.
How do we solve this with React?