Skip to content

Instantly share code, notes, and snippets.

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

@taroyanaka
taroyanaka / README.md
Created May 21, 2020 12:06 — forked from plugnburn/README.md
DaBi - live two-way DOM-to-data binding in 25 lines of JS

DaBi: data binding library that keeps it simple

DaBi (short for Data Binding) is a dead simple yet complete and self-contained DOM-to-JS and JS-to-DOM data binding library in just 25 lines of pure ES5 and 454 bytes when minified.

How to obtain

Download it right here or include it into your HTML:

@taroyanaka
taroyanaka / ramda8.js
Created October 24, 2018 02:39 — forked from sebabouche/ramda8.js
ramda: lens (lens, lensProp, lensPath, view, set, over)
import { lensProp, lensPath, view, set, over, toUpper } from "ramda"
const me = {
firstName: "Sébastien",
lastName: "Nicolaïdis",
birthDate: new Date("1979-09-13T15:00Z"),
age: 38,
hobbies: ["Rock climbing", "Horse riding", "Chess"],
parents: {
brother: {
@taroyanaka
taroyanaka / ramda7.js
Created October 24, 2018 02:39 — forked from sebabouche/ramda7.js
ramda: arrays (nth, slice, contains, head, last, tail, init...)
import {
nth,
slice,
contains,
head,
last,
tail,
init,
length,
take,
@taroyanaka
taroyanaka / ramda6.js
Created October 24, 2018 02:39 — forked from sebabouche/ramda6.js
ramda: objects (compose, inc, prop, assoc, evolve, always, add)
import { compose, inc, prop, assoc, evolve, always, add } from "ramda"
const nextAge = compose(
inc,
prop("age"),
)
console.log("nextAge", nextAge({ age: 21 }))
const celebrateBirthday = person => assoc("age", nextAge(person), person)
const person = { age: 24 }
console.log("celebrateBirthday", celebrateBirthday(person))
@taroyanaka
taroyanaka / ramda5.js
Created October 24, 2018 02:38 — forked from sebabouche/ramda5.js
ramda: assoc, assocPath, dissoc, dissocPath, omit, compose, inc, prop
import { assoc, assocPath, dissoc, dissocPath, omit, compose, inc, prop } from "ramda"
const original = {
a: "Bingo",
b: {
c: "Bingo",
d: "Bingo",
},
}
@taroyanaka
taroyanaka / ramda3.js
Created October 24, 2018 02:38 — forked from sebabouche/ramda3.js
ramda: cond, always, T, identity
import { cond, always, lte, gte, T, __, identity } from "ramda"
const water = cond([
[lte(__, 0), temp => `water freezes at ${temp}°C`],
[gte(__, 100), temp => `water boils at ${temp}°C`],
[T, temp => `nothing special happens at ${temp}°C`],
])
console.log(water(-222))
@taroyanaka
taroyanaka / ramda2.js
Created October 24, 2018 02:38 — forked from sebabouche/ramda2.js
ramda: ifElse, gte, lt, always, identity, whn, unless
import { ifElse, gte, lt, __, always, identity, when, unless } from "ramda"
// const forever21 = age => (age >= 21 ? 21 : age)
// const forever21 = ifElse(gte(__, 21), always(21), identity)
// const forever21 = unless(lt(__, 21), always(21))
const forever21 = when(gte(__, 21), always(21))
console.log("forever21(24)", forever21(24))
console.log("forever21(16)", forever21(16))
@taroyanaka
taroyanaka / ramda1.js
Created October 24, 2018 02:38 — forked from sebabouche/ramda1.js
ramda: map, filter, partial, partialRight, curry, __, pipe
import { map, filter, partial, partialRight, curry, __, pipe } from "ramda"
const publishedInYear = curry((year, book) => book.year === year)
const titlesForYear = curry((year, books) =>
pipe(
filter(publishedInYear(year)),
map(book => book.title),
)(books),
)
@taroyanaka
taroyanaka / ramda0.js
Created October 24, 2018 02:38 — forked from sebabouche/ramda0.js
ramda: compose, bboth, either, gte, prop, equals, __
import { compose, both, either, gte, prop, equals, __ } from "ramda"
const OUR_COUNTRY = "France"
const wasBornInCountry = compose(
equals(OUR_COUNTRY),
prop("birthCountry"),
)
const wasNaturalized = compose(
Boolean,