Skip to content

Instantly share code, notes, and snippets.

:octocat:
married

Vadim Dalecky streamich

:octocat:
married
  • http://localhost:8080
Block or report user

Report or block streamich

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View pub.md

146aPdVmwzwzwzW

14Pd

@streamich
streamich / lambda.js
Last active Apr 25, 2019 — forked from maxbeatty/lambda.js
using node-postgres (`pg`) in AWS Lambda
View lambda.js
import λ from "apex.js";
import { Pool } from "pg";
// connection details inherited from environment
const pool = new Pool({
max: 1,
min: 0,
idleTimeoutMillis: 120000,
connectionTimeoutMillis: 10000
});
View typescript.md

Specify required fields, rest will be optional.

export type Required<T, K extends keyof T> = Partial<T> & Pick<T, K>;

Specify which fields to omit.

export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
@streamich
streamich / gist:03d109062e4b330359dd6e11481fbd6f
Created Aug 31, 2018 — forked from kingbin/gist:9435292
Manually Start/Stop PostgresSQL on Mac
View gist:03d109062e4b330359dd6e11481fbd6f
# Stop PostgreSQL from auto starting
sudo launchctl unload -w /Library/LaunchDaemons/com.edb.launchd.postgresql-9.3.plist
# Enable PostgreSQL to auto start
sudo launchctl load -w /Library/LaunchDaemons/com.edb.launchd.postgresql-9.3.plist
# Start postgres
$ sudo su postgres
Password:
bash-3.2$ pg_ctl -D /Library/PostgreSQL/9.3/data/ start
View tweet-css.md

tweet-css

Smallest possible CSS-in-JS library.

View pubsub.md

PubSub class like this:

class PubSub {
  constructor () {
    this.el = document.createElement('div');
  }

  subscribe (eventName, handler) {
    this.el.addEventListener(eventName, handler);
@streamich
streamich / async-render.md
Last active Mar 5, 2018
Usage cases for async generator render functions: https://github.com/reactjs/rfcs/issues/29
View async-render.md

Load data on client and server:

async function * MyComponent() {
  yield (<div>Loading...</div>);
  const users = await fetch('/users');
  yield () =>
    <div>
      <UserList users={users} />
      <button onClick={this.props.onClick}>{this.props.buttonLabel}</button>
View 1-future-ideas.js
const React = require("react");
const Lifecycles = React.createLifecycleEvents({
didMount({ setState }) {
setState({
disabled: false,
});
},
didUpdate({ inputRef }) {
if (document.activeElement !== inputRef.value) {
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>For loop benchmark</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@streamich
streamich / react16-css.js
Created Oct 7, 2017
Dynamic CSS for React components using React's v16 element array render result
View react16-css.js
class Button extends Component {
@css`
background-color: #ff0000;
width: 320px;
padding: 20px;
border-radius: 5px;
border: none;
outline: none;
&:hover {
You can’t perform that action at this time.