const groupBy = key => array =>
array.reduce((objectsByKeyValue, obj) => {
const value = obj[key];
objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
return objectsByKeyValue;
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
package main | |
import "fmt" | |
//Listener is a | |
type Listener struct { | |
ID int | |
} | |
//ListenerInterface is an |
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
import 'package:architecture_playground/home_page.dart'; | |
import 'package:architecture_playground/services.dart'; | |
import 'package:flutter/material.dart'; | |
void main() async { | |
// perform long-running tasks before "runApp" to display the native splash screen | |
final services = await Services.initialize(); | |
runApp(ServicesProvider( | |
services: services, |
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
import React from 'react'; | |
import { Provider1, Provider2, Provider3 } from './'; | |
function ProviderComposer({ contexts, children }) { | |
return contexts.reduceRight( | |
// kids = accumulator, parent = currentValue | |
(kids, parent) => | |
React.cloneElement(parent, { | |
children: kids | |
}), |
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
FROM clux/muslrust as build | |
WORKDIR /app/ | |
# Deps caching begins | |
COPY Cargo.toml . | |
COPY Cargo.lock . | |
RUN mkdir src | |
RUN echo "fn main() {}" > src/main.rs |
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
#![allow(unused)] // silence unused warnings while exploring (to comment out) | |
use std::{error::Error, time::Duration}; | |
use tokio::time::sleep; | |
use redis::{ | |
from_redis_value, | |
streams::{StreamRangeReply, StreamReadOptions, StreamReadReply}, | |
AsyncCommands, Client, | |
}; |