I know there is a lot of confusion around Observables
, Iterables
, AsyncIterables
and AsyncObservables
. Let's try to break this down and the reasons for each.
When it comes to collections, you have two ways of thinking about collections, push versus pull. With pull, the consumer is in control of when you get the items, but with push, you get the values when the producer is ready.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Set up OSX preferences | |
# | |
# Updated By: Dan Levy @justsml | |
# | |
# Inspired by: https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
########################################### | |
# CONFIG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type User = ReturnType<typeof verifyUser>; | |
// ^ Type defined for 'free' | |
// + Pro: Less wasted effort aligning types AND validation. | |
// + Pro: More 'honest', not obscured by layers, `any` or `as` | |
// - Con: Easy to accidentally change a public interface. | |
// (Prefer explicit definitions at your library/module boundaries.) | |
export function verifyUser(data: { [key: string]: unknown; }) { | |
if (!data || typeof data !== 'object') | |
throw new Error(`User must be a valid object.`); |
- Save
ScrollLinesFixedCommand.py
to~/Library/Application Support/Sublime Text 3/Packages/User/
folder - Copy the suggested usage from
sublime-keymap.json
into your~/Library/Application Support/Sublime Text 3/Packages/User/Default (OSX).sublime-keymap
Hey Sublime, why the hell this isn't an available keybinding by default? Seriously, I'm tired of looking up how to do this every so often. For most of my work I've switched to Visual Studio Code, the Open Source IDE from Microsoft (still sounds wierd)... But it's genuinely amazing.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# REQUIRED ACTION: Configure your backup server vars - see OVH Server Manager's "Backups" tab. | |
# BACKUP_HOST_PREFIX: use the prefix domain for the listed "Name" value on the "Backups" tab. | |
# Example: With a 'Name' value `ftpback-bhs1-3.ip-111-222-333.net` you would need to set `BACKUP_HOST_PREFIX=ftpback-bhs1-3` | |
# Add something likethese to your ~/.bashrc - /etc/profile | |
#export OVH_SERVER_ID="ns5xxxxx.ip-x-x-x.net" | |
#export BACKUP_HOST_PREFIX="ftpback-bhs1-x" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const DEFAULT_LOCALSTACK_EDGE_PORT = 4566; | |
/** | |
* Get options for use in AWS client constructors. | |
* | |
* Configure the `AWS_ENDPOINT` environment variable to set an endpoint. | |
* | |
* ### Example | |
* | |
* To run tests w/ LocalStack: `AWS_ENDPOINT=http://127.0.0.1:4566 jest` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const checkForRedirect = (response) => { | |
// Check for temporary redirect (307), or permanent (308) | |
if (response.status === 307 || response.status === 308) { | |
const location = response.headers.get('location') | |
if (!location) { | |
return Promise.reject(new Error('Invalid HTTP Redirect! No Location header.')); | |
} | |
// You can change the behavior here to any custom logic: | |
// e.g. open a "confirm" modal, log the redirect url, etc. | |
return fetch(location) |
NewerOlder