mac
mkfile -n 2g ~/some/file.txt
linux
If you run CMD+T
on a Mac when the calculator is opened and focused,
it will toggle the "Paper Tape" window for the calculator, which
displays a history of the calculations you've performed.
A nice feature that I just found (accidentally).
Most recently tested on macOS Big Sur Version 11.4
An example of a TypeScript Method Decorator, also known as an "annotation" in other languages.
You can use a decorator like @Decorator
on a method inside of a class
.
export function Decorator <Args extends any[], Result extends any> (target: Object, propertyKey: string, descriptor: TypedPropertyDescriptor<(...args: Args) => Result>) {
const originalMethod = descriptor.value // save a reference to the original method
// NOTE: Do not use arrow syntax here. Use a function expression in
// order to use the correct value of `this` in this method (see notes below)
if (originalMethod) {
A simple live-reload implementation that refreshes the page when the source file changes on disk.
The server.js
file just serves the files in the directory that
it is in, including itself. It also ensures that a private
Cache-Control
header is set for GET
requests, and
caching disabled for other HTTP methods.
The index.html
file contains a hand-rolled live-reload script
that polls the server every 2 seconds and honors the HTTP 304
response code and the caching and etag directives specified by
What the built-in string 'some cool string'.split(' ')
does:
--> converts 'some cool string'
to ['some', 'cool', 'string']
with a resulting type of string[]
What you can do with TypedSplit('some cool string', ' ')
from this gist:
--> converts 'some cool string'
to ['some', 'cool', 'string']
with a resulting type of ['some', 'cool', 'string']
// make sure you `npm install twilio` before you run | |
const config = { | |
// get your credentials from the twilio console: www.twilio.com/console | |
// can also be configured as environment variables instead | |
accountSid: '<twilio account sid>', | |
authToken: '<twilio auth token>', | |
// on a twilio trial account, you can only send from and to confirmed or purchased numbers | |
// upgrade your account to send to any number | |
from: '+10000000000', |
# https://stackoverflow.com/questions/3349105/how-to-set-current-working-directory-to-the-directory-of-the-script-in-bash | |
cd "${0%/*}" |