Skip to content

Instantly share code, notes, and snippets.

View justsml's full-sized avatar
🔥
#BLM

Dan Levy justsml

🔥
#BLM
View GitHub Profile

Iterables, AsyncIterables, Observables, Oh My!

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.

Pull versus Push Collections

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.

Pull Based Collections

@justsml
justsml / setupOSX.sh
Last active March 21, 2024 09:28 — forked from tylerwalts/setupOSX.sh
This is a bash script to setup Mac OS X defaults on a new mac.
#!/bin/bash
#
# Set up OSX preferences
#
# Updated By: Dan Levy @justsml
#
# Inspired by: https://github.com/mathiasbynens/dotfiles/blob/master/.osx
###########################################
# CONFIG
@justsml
justsml / postgres cheatsheet.md
Created December 10, 2018 00:25 — forked from apolloclark/postgres cheatsheet.md
postgres cheatsheet

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

@justsml
justsml / insertAdjacentHTML.js
Last active February 26, 2021 10:24 — forked from eligrey/insertAdjacentHTML.js
insertAdjacentHTML polyfill
/*
* Updated w/ insertAdjacentElement
* @author Dan Levy @justsml
* 2016-06-23
*
* Credit: @lyleunderwood - afterend patch/fix
*
* ```js
* import { insertAdjacentElement } from './libs/insertAdjacentHTML.js';
* Use either:
@justsml
justsml / setup_osx.sh
Last active October 20, 2020 03:00 — forked from rands0n/setup_osx.sh
setup_osx
#!/bin/sh
echo "Starting XCode Command Line Tools Setup... Continue using the GUI prompt..."
sleep 4s
xcode-select --install
echo "DONE: Installing XCode Command Line Tools\!"
# install homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Speaker Rider

by Tatiana Mac

Before I'll agree to a speaking event, I try to do as much research I can around the event to ensure it aligns with my ethos. I want to share this in case it's helpful to any other speakers.

👐 Speaking comes with immense privilege. I am grateful to all the conference organisers who have brilliantly hosted me. I would love to continue to exercise this privilege to speak at conferences, and use this privilege to make the landscape more accessible and beneficial to tech's most marginalised and suppressed communities.

😫 I wish I didn't have to, but this is long because I provide a lot of explanations for those of you who never had to consider these things. And I will be honest, most thoughtful conferences I've attended check most of these boxes intrinsically, particularly when conference runners are experienced speakers. They get it.

1️⃣ All of these are based on my own ethos. I don't wish to or attempt to speak on behalf of all conference speake

@justsml
justsml / auth-complex.js
Last active November 8, 2018 23:49 — forked from TimMensch/auth-complex.js
Minor updates
// Easier to follow. Equally easy to test -- and with one fewer function in need of testing.
import { userInfo } from "os";
const Promise = require("bluebird");
const { hashStringAsync } = Promise.promisifyAll(require("./lib/crypto"));
const { logEventAsync } = Promise.promisifyAll(require("./lib/log"));
const { openAsync } = Promise.promisifyAll(require("./lib/db"));
const { TimeoutError, ValidationError, NotFoundError } = require("./errors");
@justsml
justsml / myController.js
Last active August 29, 2018 02:43 — forked from Tinusw/myController.js
a promise example
const mongoose = require('mongoose');
const Store = mongoose.model('Store');
const StoreB = mongoose.model('StoreB');
// Tells package to use es6 promises
mongoose.Promise = global.Promise;
exports.createStore = (req, res, next) => {
const store = new Store(req.body);
const itemB = StoreB
@justsml
justsml / postgres-cheatsheet.md
Created July 11, 2018 01:41 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@justsml
justsml / bluebird-concurrent-download-using-map-then.js
Last active December 2, 2017 21:29 — forked from joepie91/.js
Promise map (Bluebird)
const Bluebird = require('bluebird')
const got = require('got')
const urls = [
"http://www.google.com/",
"http://www.yahoo.com/",
"http://www.bing.com/",
];
// Bluebird is an extension of promises: