Skip to content

Instantly share code, notes, and snippets.

query = select("projects", anyOf([
where(anyOf([{
number_one: niceNumbers,
number_two: niceNumbers
}, {
number_three: anyOf([ 42, column("number_one") ]),
number_four: moreThan(1337)
}]))
]));
@joepie91
joepie91 / gist:4d1dbebfd00b842ffaa165232e2aaac4
Last active April 15, 2020 19:44
Better, categorized documentation of parjs parsers/combinators
# parjs combinators
## Characters
digit ASCII(?) digit in <base>
hex ASCII(?) digit in base 16 (hex)
uniDecimal unicode digit in base 10 (decimal)
letter ASCII letter
uniLetter unicode letter
const immutableCollection = require("./");
let items = [{
id: 1,
color: "blue"
}, {
id: 2,
color: "red"
}, {
id: 3,
@joepie91
joepie91 / gist:606cd5a48987c484bce027c10f268282
Created November 12, 2019 00:30
css-loader internals notes
Loader utils
- parseString: Parse a given string as if it were a JSON-encoded string, mapping single-quote string boundaries to double-quote boundaries or just flat-out making up those boundaries, so that JSON.parse doesn't complain. If cannot be parsed as JSON, just return the string as-is. Seems to be used to decode escape codes in a variety of (non-JSON) strings.
- urlToRequest: "Converts some resource URL to a webpack module request."
- isUrlRequest: "Before call urlToRequest you need call isUrlRequest to ensure it is requestable url"
Docs here: https://www.npmjs.com/package/icss-utils
=====================
PostCSS
"use strict";
const Promise = require("bluebird");
const AWS = require("aws-sdk");
AWS.config.update({ region: "eu-central-1" });
module.exports = function createRDSInstance(identifier) {
let rds = new AWS.RDS();
return Promise.try(() => {
@joepie91
joepie91 / gist:70e2bdef2c15774bbc195e3e1d4b05fa
Created April 13, 2019 16:29
smartctl / smartmontools flag format decoding
PO--CK 0x0033 51 0 0 1 1 0 0 1 1
-O--CK 0x0032 50 0 0 1 1 0 0 1 0
----CK 0x0030 48 0 0 1 1 0 0 0 0
POSR-K 0x002f 47 0 0 1 0 1 1 1 1
-OSR-K 0x002e 46 0 0 1 0 1 1 1 0
POS--K 0x0027 39 0 0 1 0 0 1 1 1
-O---K 0x0022 34 0 0 1 0 0 0 1 0
---R-- 0x0008 8 0 0 0 0 1 0 0 0
K C R S O P
| | | | | |_ P prefailure warning
@joepie91
joepie91 / js-tooling.md
Last active March 26, 2024 19:52
An overview of Javascript tooling

Getting confused about the piles of development tools that people use for Javascript? Here's a quick index of what is used for what.

Keep in mind that you shouldn't add tools to your workflow for the sake of it. While you'll see many production systems using a wide range of tools, these tools are typically used because they solved a concrete problem for the developers working on it. You should not add tools to your project unless you have a concrete problem that they can solve; none of the tools here are required.

Start with nothing, and add tools as needed. This will keep you from getting lost in an incomprehensible pile of tooling.

Build/task runners

Typical examples: Gulp, Grunt

@joepie91
joepie91 / you-dont-need-a-blockchain.md
Last active March 1, 2024 03:36
You Don't Need A Blockchain

You don't need a blockchain.

If you're reading this, you probably suggested to somebody that a particular technical problem could be solved with a blockchain.

Blockchains aren't a desirable thing; they're defined by having trustless consensus, which necessarily has to involve some form of costly signaling to work; that's what prevents attacks like sybil attacks.

In other words: blockchains must be expensive to operate, to work effectively. This makes it a last-resort solution, when you truly have no other options available for solving your problem; in almost every case you want a cheaper and less complex solution than a blockchain.

In particular, if your usecase is commercial, then you do not need or want trustless consensus. This especially includes usecases like supply chain tracking, ticketing, and so on. The whole *p

// file: serial.js
const SerialPort = require('serialport')
module.exports = function() {
const port = SerialPort('path/to/serial/port')
const e = new events.EventEmitter()
// listen for incoming serial data
port.on('data', function (data) {

How to install Node.js applications, if you're not a Node.js developer

While installing a Node.js application isn't difficult in principle, it may still be confusing if you're not used to how the Node.js ecosystem works. This post will tell you how to get the application going, what to expect, and what to do if it doesn't work.

Occasionally an application may have custom installation steps, such as installing special system-wide dependencies; in those cases, you'll want to have a look at the install documentation of the application itself as well. However, most of the time it's safe to assume that the instructions below will work fine.

If the application you want to install is available in your distribution's repositories, then install it through there instead and skip this entire guide; your distribution's package manager will take care of all the dependencies.

Checklist