type StringBool = "true"|"false";
interface AnyNumber { prev?: any, isZero: StringBool };
interface PositiveNumber { prev: any, isZero: "false" };
type IsZero<TNumber extends AnyNumber> = TNumber["isZero"];
type Next<TNumber extends AnyNumber> = { prev: TNumber, isZero: "false" };
type Prev<TNumber extends PositiveNumber> = TNumber["prev"];| # Pass the env-vars to MYCOMMAND | |
| eval $(egrep -v '^#' .env | xargs) MYCOMMAND | |
| # … or ... | |
| # Export the vars in .env into your shell: | |
| export $(egrep -v '^#' .env | xargs) |
| # one or the other, NOT both | |
| [url "https://github"] | |
| insteadOf = git://github | |
| # or | |
| [url "git@github.com:"] | |
| insteadOf = git://github |
node.js fs module was originally designed to copy linux's standard way of handling files. This means for deleteing files using the unlink functionality. For Windows, however, unlink operates differently - differently enough that I encountered several issues with unlink.
Why on Windows? Electron, mostly - I needed to handle a file post-creation via a child_process (in this case, a terminal execution of ffmpeg).
Windows unlink works by using ZwSetInformation (a low level Windows API/function) to set a file property DeleteFile to TRUE. Windows will then eventually, once the file is no longer being accessed by any process "delete" the file in whatever way it is wont to do (Recycle Bin versus full delete, etc). However, even if a child process created the file, it seems that the file can possibly be linked back to the parent process, preventing the parent process from ever actually deleting the file.
Even if the unlink process fires correctly, if Windows believes the file is stil
| function ShowAutocompletion(obj) { | |
| // Disable default autocompletion for javascript | |
| monaco.languages.typescript.javascriptDefaults.setCompilerOptions({ noLib: true }); | |
| // Helper function to return the monaco completion item type of a thing | |
| function getType(thing, isMember) { | |
| isMember = (isMember == undefined) ? (typeof isMember == "boolean") ? isMember : false : false; // Give isMember a default value of false | |
| switch ((typeof thing).toLowerCase()) { | |
| case "object": |
Last updated March 13, 2024
This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.
Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.
For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.
"A phantom type is a parametrised type whose parameters do not all appear on the right-hand side of its definition..." Haskell Wiki, PhantomType
The following write-up is intended as an introduction into using phantom types in ReasonML.
Taking a look at the above definition from the Haskell wiki, it states that phantom types are parametrised types where not all parameters appear on the right-hand side. Let's try to see if we can implement a similar example as in said wiki.
| /** | |
| * Making promises | |
| */ | |
| let okPromise = Js.Promise.make((~resolve, ~reject as _) => [@bs] resolve("ok")); | |
| /* Simpler promise creation for static values */ | |
| Js.Promise.resolve("easy"); | |
| Js.Promise.reject(Invalid_argument("too easy")); |