See
- https://shadow-cljs.github.io/docs/UsersGuide.html#_cursive
- https://andrearichiardi.com/blog/posts/clojurescript-cursive-shadow-setup.html
- in shadow-cljs.edn:
,,,
const { mkdir, readdir, rename, stat } = require('fs/promises'); | |
async function main() { | |
try { | |
await mkdir('./photos') | |
console.debug('Photo directory successfully created'); | |
} catch (err) { | |
console.debug('Photo directory already exist'); | |
} |
// Because we're using an ORM (Objection), it's a pain to add a tsvector when inserting, | |
// since tsvectors and FTS aren't supported by Objection. Instead, I've added a hook that | |
// fires on insert which auto-generates the tsvector field for each newly inserted entry. | |
// This is an example knex migration file for said behavior. | |
const addUserIndex = ` | |
ALTER TABLE public.user ADD "document" tsvector; | |
CREATE FUNCTION my_trigger_function() | |
RETURNS trigger AS $$ |
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!
In your command-line run the following commands:
brew doctor
brew update
function timerMiddleware({dispatch, getState}) { | |
const timers = {}; | |
return next => action => { | |
if(action.type == "START_TIMER") { | |
const {action, timerName, timerInterval} = action.payload; | |
clearInterval(timers[timerName]); |
function solution(N) { | |
return parseInt(N, 10). | |
toString(2). | |
replace(/^0+|0+$/g, ''). | |
split('1'). | |
reduce(function (a, b) { | |
return a.length > b.length ? a : b; | |
}).length | |
} |
syntax on | |
set number | |
set ruler | |
set backspace=indent,eol,start | |
" Makes vim use the clipboard directly for yank, etc. | |
set clipboard=unnamed | |
" Tabs and Indentation |