Original(japanese) https://zenn.dev/mizchi/articles/standalone-html-frontend
Mostly translated by deepl
Note: Do not use in production, tailwind is running in CDN mode and esm.sh builds scripts dynamically, so performance is not good.
Original(japanese) https://zenn.dev/mizchi/articles/standalone-html-frontend
Mostly translated by deepl
Note: Do not use in production, tailwind is running in CDN mode and esm.sh builds scripts dynamically, so performance is not good.
Working with DATE
, TIMESTAMP
, and INTERVAL
in PostgreSQL can be confusing. In this article I will go over the three date/time related data types, and the two most useful date/time functions: DATE_PART
and DATE_TRUNC
. Finally, I will provide some real life examples of how these types and functions can be used within queries.
PostgreSQL Date/Time Documentation
The DATE
type contains the year
, month
, and day
of a date. It is not possible to do any type of time
related functions on a DATE
without first converting it to a TIMESTAMP
. Subtracting two DATE
values from one another results in an INT
representing the # of days between.
The TIMESTAMP
type contains a year
, month
, day
, hour
, minute
, second
, and microsecond
. This is the type that I most often use.
# To use the "confirm" target inside another target, | |
# use the " if $(MAKE) -s confirm ; " syntax. | |
mycommand: | |
@if $(MAKE) -s confirm ; then \ | |
execute_your_command_here ; \ | |
fi | |
.PHONY: mycommand | |
# The CI environment variable can be set to a non-empty string, |
<?php | |
function m() | |
{ | |
$memory = round(memory_get_usage() / 1024 / 1024, 2); | |
$frame = debug_backtrace(0, 1)[0]; | |
$file = basename($frame['file']); | |
$line = $frame['line']; | |
printf("%s:%d | %sMb\n", $file, $line, $memory); |
const Promise = require('bluebird') | |
const lambdas = require('./lambdas.js') | |
// Ref: https://stackoverflow.com/questions/25817366/bluebird-promise-all-multiple-promises-completed-aggregating-success-and-rejec | |
Promise.all(lambdas.map(function(promise) { | |
// On utilise l'API reflect pour inspecter a la main nos promesses voir http://bluebirdjs.com/docs/api/reflect.html | |
// grace a ca, la promesse réussira toujours | |
return promise.reflect(); | |
})).each(function(inspection) { | |
// Ici la lambda (ou promesse) a réussi |
This guide provides instructions for an Arch Linux installation featuring full-disk encryption via LVM on LUKS and an encrypted boot partition (GRUB) for UEFI systems.
Following the main installation are further instructions to harden against Evil Maid attacks via UEFI Secure Boot custom key enrollment and self-signed kernel and bootloader.
You will find most of this information pulled from the Arch Wiki and other resources linked thereof.
Note: The system was installed on an NVMe SSD, substitute /dev/nvme0nX
with /dev/sdX
or your device as needed.
9 March, 2019
We were discussing with @erusev what we can do with async operation when using useReducer()
in our application. Our app is simple and we don't want to use a state management library. All our requirements are satisfied with using one root useReducer()
. The problem we are facing and don't know how to solve is async operations.
In a discussion with Dan Abramov he recommends Solution 3 but points out that things are fresh with hooks and there could be better ways of handling the problem.
#!/bin/bash | |
# Sway WM screen + audio recorder | |
# original author: Aaron D. Fields | |
# blog post: https://blog.spirotot.com/2017/08/21/a-dirty-hack-to-enable-acceptable-sway-wm-screen-recording/ | |
# currently error 503 :-( | |
# | |
# Updated version: ernierasta | |
# Repo: https://gist.github.com/ernierasta | |
# | |
# Changelog: |
const canvasSketch = require('canvas-sketch'); | |
const random = require('canvas-sketch-util/random'); | |
const { lerp, lerpArray } = require('canvas-sketch-util/math'); | |
const palettes = require('nice-color-palettes'); | |
const settings = { | |
dimensions: 'A4', | |
orientation: 'landscape', | |
units: 'cm', | |
pixelsPerInch: 300 |