Skip to content

Instantly share code, notes, and snippets.

@davidwatkins73
davidwatkins73 / Liquibase-XML-inserts.xml.groovy
Last active June 26, 2024 06:16
Jetbrains Intellij / Datagrip: Data Extractor - allows export of row data into Liquibase compatible insert statements
/*
* Available context bindings:
* COLUMNS List<DataColumn>
* ROWS Iterable<DataRow>
* OUT { append() }
* FORMATTER { format(row, col); formatValue(Object, col) }
* TRANSPOSED Boolean
* plus ALL_COLUMNS, TABLE, DIALECT
*
* where:
@fnky
fnky / ANSI.md
Last active April 20, 2025 07:44
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@jberndsen
jberndsen / promise.js
Last active August 7, 2019 04:56
exercises to learn promises
// BEFORE YOU start
// npm init -y
// npm install --save node-fetch
const fetch = require('node-fetch');
// INTRO
// Javascript is single threaded, meaning that two bits of script cannot run at the same time.
// Doing something which takes some time (a costly algorithm, a back-end call) causes everything else to halt
// until it completes. In browsers, this often means the UI becomes non-responsive,
// because the rendering of the screen is blocked.
/////////
// LESSION MATERIAL FOR .map, .filter, .reduce, function composition and currying
/////////
const list = [1, 2, 3, 4, 5];
const anotherList = ['h', 'e', 'l', 'l', 'o'];
let result;
// map is used to transform each element in the array
@vbsessa
vbsessa / chrome-devtools.md
Last active February 28, 2025 03:42
How to customize Chrome devtools fonts
  1. Enable #enable-devtools-experiments flag in chrome://flags section.

  2. Open Chorme Devtools and check Settings > Experiments > Allow extensions to load custom stylesheets.

  3. Create the following four files in a dedicated folder.

    3.1. devtools.html

    <html>
    <head></head>
    <body><script src="devtools.js"></script></body>
@jboner
jboner / latency.txt
Last active April 19, 2025 21:29
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@alex-cellcity
alex-cellcity / Version.m
Created May 30, 2011 04:55
Runtime iOS Version Checking
/*
* System Versioning Preprocessor Macros
*/
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)