This file contains hidden or 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
| version: '2' | |
| services: | |
| myapp: | |
| build: . | |
| container_name: "myapp" | |
| image: debian/latest | |
| environment: | |
| - NODE_ENV=development | |
| - FOO=bar | |
| volumes: |
This file contains hidden or 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
| let cache = [] | |
| JSON.stringify( someObject, (key, value) => { | |
| if (typeof value === 'object' && value !== null) { | |
| if (cache.indexOf(value) !== -1) { | |
| // Circular reference found, discard key | |
| return | |
| } | |
| // Store value in our collection | |
| cache.push(value) | |
| } |
This file contains hidden or 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
| import { resolve as resolvePath } from 'path' | |
| import { fileURLToPath } from 'url' | |
| import { stat } from 'fs/promises' | |
| const loggingEnabled = false | |
| const consoleLog = (verb, ...args) => loggingEnabled && console[verb](...args) | |
| const log = { | |
| d: (...args) => consoleLog('log', ...args), | |
| i: (...args) => consoleLog('info', ...args), |
This file contains hidden or 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
| final Map<String, String> currencyFlags = { | |
| "COP": "🇨🇴", | |
| "USD": "🇺🇸", | |
| "AED": "🇦🇪", | |
| "AFN": "🇦🇫", | |
| "ALL": "🇦🇱", | |
| "AMD": "🇦🇲", | |
| "ANG": "🇳🇱", | |
| "AOA": "🇦🇴", | |
| "ARS": "🇦🇷", |
This file contains hidden or 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
| (function() { | |
| const result = [] | |
| const tables = [...document.querySelectorAll('table')] | |
| const quoteRow = cols => ('"' + cols | |
| .map(it => it.textContent || '') | |
| .join('","') + '"') | |
| for (let i = 0, m = tables.length; i < m; i++) { |
This file contains hidden or 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 downloadCsv = (text, filename, encoding = 'text/plain') => { | |
| // text/csv | |
| const blob = new Blob([csvString], { type: encoding }) | |
| const url = window.URL.createObjectURL(blob) | |
| const a = document.createElement('a') | |
| a.setAttribute('href', url) | |
| a.setAttribute('download', filename || 'download.txt') | |
| a.style.display = 'none' |
This file contains hidden or 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 section = document.querySelector('[data-testid="desktop-custom-records"]') | |
| const table = section.nextElementSibling.querySelector('table') | |
| const headers = [...table.querySelector('thead') | |
| .querySelector('tr') | |
| .querySelectorAll('th') | |
| ].map(it => it.innerText) | |
| const rows = table.querySelector('tbody').querySelectorAll('tr') | |
| const csv = [headers] | |
| for (let i = 0; i < rows.length; i++) { |
This file contains hidden or 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
| interface Observer<T> { | |
| fun onChange(newValue: T?) | |
| } | |
| class Observable<T>(initialValue: T? = null) { | |
| // List ov observers watching this value for changes | |
| private val observers = mutableListOf<Observer<T>>() | |
| // The real value of this observer |
This file contains hidden or 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
| // https://github.com/sequelize/sequelize/issues/8984#issuecomment-738790473 | |
| // Here is a workaround to delete new indices after calling sequelize.sync({alter: true}); | |
| // Be careful, this will delete all indices of the current database that ends with a number after an underline character (e.g. index_1) | |
| const rawTables = await this.sequelize.query("SHOW TABLES") | |
| const tables = rawTables[0].map(i => i[Object.keys(rawTables[0][0])[0]]) | |
| for (const t of tables) { | |
| const rawKeys = await this.sequelize.query(`SHOW INDEX FROM ${t}`) |
This file contains hidden or 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
| -- https://stackoverflow.com/a/33293747/717949 | |
| -- NOTE: the WHERE condition at the end can be removed for smaller tables | |
| -- check for FKs where there is no matching index | |
| -- on the referencing side | |
| -- or a bad index | |
| WITH fk_actions ( code, action ) AS ( | |
| VALUES ( 'a', 'error' ), | |
| ( 'r', 'restrict' ), |
NewerOlder