const groupBy = key => array =>
array.reduce((objectsByKeyValue, obj) => {
const value = obj[key];
objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
return objectsByKeyValue;
This file contains hidden or 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
| function replaceAt(indexArray, string) { | |
| const func = (string, i) => { | |
| string[i] = ( | |
| <span className="font-bold text-red" key={i}> | |
| {string[i]} | |
| </span> | |
| ); | |
| return string; | |
| }; |
This file contains hidden or 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 ReactDOM from "react-dom"; | |
| function App() { | |
| const orders = [ | |
| { date: 1556396396, project: "Project 1" }, | |
| { date: 1556396416, project: "Project 2" }, | |
| { date: 1552186577, project: "Project 3" }, | |
| { date: 1554064562, project: "Project 4" }, | |
| { date: 1556396473, project: "Project 5" }, |
This file contains hidden or 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 hidden or 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
| WDIR := /go/src/github.com/Pisush/tensorflow-and-go | |
| DIR := ${CURDIR}:${WDIR} | |
| DOCKER_IMAGE := dahernan/tensorflow-and-go | |
| login: | |
| docker run -i -v $(DIR) -w $(WDIR) --entrypoint=/bin/bash -t $(DOCKER_IMAGE) | |
| dockerbuild: | |
| docker build -f Dockerfile -t $(DOCKER_IMAGE) . |
This file contains hidden or 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, { useEffect, useState, useRef, useReducer } from "react"; | |
| import { Link } from "react-router-dom"; | |
| export const Test = () => { | |
| const [input, setInput] = useState("world"); | |
| const [data, refetch] = useGrpcRequest(myRequest, { name: "init" }, []); | |
| // useEffect(() => console.clear(), []); | |
| const handleOnClick = () => { |
This file contains hidden or 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 ( | |
| stmtCreateUser = iota | |
| stmtGetUser | |
| stmtUpdateUser | |
| ) | |
| var stmtPairs = []struct { | |
| id int | |
| stmt string | |
| }{ |
This file contains hidden or 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
| // https://play.golang.org/p/5p28UL4thc_r | |
| package main | |
| import "fmt" | |
| func main() { | |
| s := InitializeServices() // Inject *sql.DB here | |
| s.CreateAuthor(0, "name", "[email protected]") // Example http/grpc/graphql endpoints |
This file contains hidden or 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 const useGrpcRequest = (func, setState) => { | |
| const [params, setParams] = useState(null); | |
| useEffect(() => { | |
| let unmounted = false; | |
| (async () => { | |
| try { | |
| if (!params) return; | |
| const result = await func(params); | |
| if (unmounted) return; |
This file contains hidden or 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 |