Optional - Set format on save and any global prettier options
npm i -D eslint prettier eslint-plugin-prettier eslint-config-prettier eslint-plugin-node eslint-config-node
// Inspired by Tailwind Daisy UI progress bar: https://daisyui.com/components/radial-progress/ | |
// This is a custom-made progress circular/radial progress bar with centered percentage text. | |
// Tested with Tailwind 3.x. Should work with lower versions of Tailwind CSS as well. | |
STEP 1: Add the following custom CSS: | |
.progress-ring__circle { | |
transition: stroke-dashoffset 0.35s; | |
transform: rotate(-90deg); | |
transform-origin: 50% 50%; |
import InplaceEdit from "./InplaceEdit" | |
class App extends React.Component { | |
render() { | |
return ( | |
<InplaceEdit | |
isUpdatingId={true || false} | |
id={idForTheField || ""} | |
updateKey={keyToReturnAnObjectWith || ""} | |
onUpdate={functionToCallForTheUpdate || (() => {})} |
// For: @musaid | |
// https://twitter.com/musaid/status/1039688749205020672 | |
// Ligatures built into Operator Mono as "Operator Mono Lig" with https://github.com/kiliman/operator-mono-lig | |
// VS Code Extensions: vscode-icons, indent-rainbow, Rainbow Brackets, Git Lense and Prettier (require config file with requireConfig) | |
// VS Code Theme: Night Owl -- custom colors for a bit higher contrast | |
{ | |
"editor.tabSize": 2, | |
"editor.insertSpaces": true, | |
"window.zoomLevel": 1, | |
"editor.fontSize": 18, |
/** | |
* For compare function return: | |
* - Less than zero: item1 has higher priority than item2. | |
* - Zero: same. | |
* - Greater than zero: item1 has lower priority than item2. | |
*/ | |
export type CompareFunction<T> = (item1: T, item2: T) => number; | |
export class PriorityQueue<T> { | |
_items: Array<T>; |
import { Base64 } from 'js-base64' | |
import { Op } from 'sequelize' | |
import { fromGlobalId } from 'graphql-relay' | |
// https://github.com/graphql/graphql-relay-js/issues/94#issuecomment-232410564 | |
const effectiveOrder = ({ last }, orderBy) => { | |
/* adds `id ASC` to end of `ORDER BY` if `id` is not already in the `ORDER BY` clause | |
flips `ASC` to `DESC` (and vice-versa) if pagination arg `last` is defined | |
*/ |
const http = require('http'); | |
const memwatch = require('memwatch-next'); | |
const heapdump = require('heapdump'); | |
var server = http.createServer((req, res) => { | |
for (var i=0; i<1000; i++) { | |
server.on('request', function leakyfunc() {}); | |
} | |
res.end('Hello World\n'); |
const Koa = require('koa'); | |
const app = new Koa(); | |
app.use(ctx => { | |
ctx.body = 'Hello World'; | |
}); | |
var listener = app.listen(process.env.PORT || 3000, () => { | |
console.log(`Listening on port ${listener.address().port}`); | |
}); |
worker_processes auto; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include mime.types; | |
default_type application/octet-stream; |