Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Ely ElyDotDev

🏠
Working from home
View GitHub Profile
@zachsa
zachsa / pg-cursor iterator example.js
Last active Jun 23, 2021
Example of how to create a row iterator using pg-cursor
View pg-cursor iterator example.js
const createIterator = async sql => {
const client = await pool.connect()
const cursor = client.query(new Cursor(sql))
const batchSize = 100
return (async function getRows(client, cursor, batchSize) {
let done = false
// Get next rows
const rows = await new Promise((resolve, reject) =>
@mpolci
mpolci / dynamic-redux-sagas.md
Last active Jan 14, 2022
Helper function creating a dynamic saga for code splitting with redux-saga
View dynamic-redux-sagas.md

Helper function

This function create a saga that runs the sagas in the startingSagas array and takes the actions with type indicated by changeActionType to replace the running sagas. The replacing actions must have a field sagas cointaining the array with the new sagas.

function createDynamicSaga (changeActionType, startingSagas) {
  function* _start (sagas) {
    try {
      yield sagas
@markerikson
markerikson / appEntryPoint.js
Last active Apr 28, 2021
Webpack React/Redux Hot Module Reloading (HMR) example
View appEntryPoint.js
import React from "react";
import ReactDOM from "react-dom";
import configureStore from "./store/configureStore";
const store = configureStore();
const rootEl = document.getElementById("root");
View gist:8a3b0f67d17424f05ecc
/* Responsive hack - Bootstrap */
@screen-xs: 300px;
@screen-xs-min: @screen-xs;
@screen-phone: @screen-xs-min;
// Small screen / tablet
// Note: Deprecated @screen-sm and @screen-tablet as of v3.0.1
@screen-sm: 620px;
@screen-sm-min: @screen-sm;
@screen-tablet: @screen-sm-min;