This file contains 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
const DB = require('../db') | |
const insertOrUpdate = (tableName, rows) => { | |
return DB.transaction((trx) => { | |
const queries = rows.map((tuple) => { | |
const insert = trx(tableName).insert(tuple).toString() | |
const update = trx(tableName).update(tuple).toString().replace(/^update(.*?)set\s/gi, '') |
This file contains 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
if [ $UID -eq 0 ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi | |
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" | |
PROMPT='%{$terminfo[bold]$fg[green]%}%n@%m %{${fg_bold[blue]}%}:: %{$reset_color%}%{${fg[cyan]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} ' | |
RPS1="${return_code}" | |
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" |
This file contains 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
Array.prototype.reduceCustom = function(callback, initialValue) { | |
const array = this | |
if (!array.length) { | |
if (initialValue) { | |
return initialValue | |
} | |
throw new Error('TypeError: Reduce of empty array with no initial value') | |
} |