In this tutorial we're going to build a set of parser combinators.
We'll answer the above question in 2 steps
- what is a parser?
- and.. what is a parser combinator?
So first question: What is parser?
| SELECT * FROM information_schema.sequences; | |
| SELECT last_value FROM <sequence_name>; | |
| ALTER SEQUENCE <sequence_name> RESTART WITH <last_value + 1>; |
| package db | |
| type Config struct { | |
| Dialect string `yaml:"DB_DIALECT"` | |
| Host string `yaml:"DB_HOST"` | |
| Port string `yaml:"DB_PORT"` | |
| DBName string `yaml:"DB_NAME"` | |
| Username string `yaml:"DB_USER"` | |
| Password string `yaml:"DB_PASS"` | |
| } |
| const isClient = typeof window !== 'undefined'; | |
| const isLocalStorageSP = () => { | |
| try { | |
| window.localStorage.setItem('testKey', 1); | |
| window.localStorage.removeItem('testKey'); | |
| return true; | |
| } catch (e) { | |
| return false; | |
| } |
| function loadJS(url) { | |
| return new Promise((resolve, reject) => { | |
| const element = document.createElement('script'); | |
| element.async = true; | |
| element.src = url; | |
| element.onload = () => { | |
| resolve(url); | |
| } |
| docker run --restart=always -d \ | |
| -p 5435:5432 \ | |
| --name [db_name] \ | |
| -e POSTGRES_PASSWORD="" \ | |
| -e POSTGRES_DB=[db_name] \ | |
| postgres |
| #!/bin/bash | |
| # | |
| # Backup a Postgresql database into a daily file. | |
| # | |
| BACKUP_DIR=/pg_backup | |
| DAYS_TO_KEEP=14 | |
| FILE_SUFFIX=_pg_backup.sql | |
| DATABASE= | |
| USER=postgres |
| f = open('input', 'r') | |
| n = int(f.readline().strip()) | |
| data = [] | |
| for line in f.readlines() : | |
| data.append(line.strip()) | |
| f.close() |
| function isOk(input) { | |
| if (Array.isArray(input)) return input.length > 0; | |
| if (typeof input === 'object' && input) return Object.keys(input).length > 0; | |
| if (typeof input === 'number') return true; | |
| return Boolean(input); | |
| } |
| {pages.map(page => { | |
| return ( | |
| <button | |
| key={page} | |
| style={currentPage === page ? { backgroundColor: '#fdce09' } : null} | |
| {...getPageItemProps({ | |
| pageValue: page, | |
| onPageChange: this.handlePageChange | |
| })} | |
| > |