Skip to content

Instantly share code, notes, and snippets.

Dustin Deus StarpTech

Block or report user

Report or block StarpTech

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 benchmark-bench.js
#!/usr/bin/env node
'use strict'
const inquirer = require('inquirer')
const bench = require('./lib/bench')
const { choices, list } = require('./lib/packages')
const argv = process.argv.slice(2)
async function select (callback) {
const result = await inquirer.prompt([
@StarpTech
StarpTech / docker-compose.cypress.yml
Last active Oct 2, 2019
Generate Github Actions Workflow to run Cypress Tests in parallel (with artifact support + Basic Auth)
View docker-compose.cypress.yml
version: '3.4'
services:
cypress:
container_name: 'cypress-e2e'
image: 'cypress/included:3.4.1'
working_dir: /e2e
volumes:
- .:/e2e
environment:
@StarpTech
StarpTech / react-hooks-axios.js
Created Jun 3, 2019
React Hooks Axios Client
View react-hooks-axios.js
// Inspired by https://www.robinwieruch.de/react-hooks-fetch-data/
const dataFetchReducer = (state, action) => {
switch (action.type) {
case 'REQUEST_INIT':
return { ...state, isLoading: true, isError: false };
case 'REQUEST_SUCCESS':
return { ...state, isLoading: false, isError: false, data: action.payload };
case 'REQUEST_FAILURE':
return { ...state, isLoading: false, isError: true };
@StarpTech
StarpTech / redis-cache-service.js
Last active Oct 5, 2019
Simple Redis Cache Client for Node.js
View redis-cache-service.js
'use strict';
const assert = require('assert');
/**
* The redis client is https://github.com/luin/ioredis
*/
/*
const redisClient = new Redis({
@StarpTech
StarpTech / graphql-caching.md
Last active Nov 4, 2018
Notes about Caching in GraphQL
View graphql-caching.md

Graphql cache challenges

How to practice HTTP Caching?

GraphQL queries are usually POST requests. POST request aren't cached by nature. This means that we need different solutions to deliver our content efficiently.

@StarpTech
StarpTech / fab.ts
Last active Oct 29, 2018
Small library to validate numeric data structures in a functional-style
View fab.ts
/**
* Small library to validate numeric data structures in a functional-style
* All functions are right associative
* If you are looking for more sophisticated features have a look at
* https://ramdajs.com/
*/
export interface FabPattern {
[index: string]: (input: number) => boolean;
}
@StarpTech
StarpTech / arangodb.js
Last active Apr 11, 2018
Manage Multi-Tenancy in Arangojs
View arangodb.js
// initialize
// The maximum number of requests is equal to
// maxSockets * 2 with keepAlive: true or equal to maxSockets with keepAlive: false.
const arangodb = new Arangojs.Database({
url: "http://localhost:8529", // Base URL of the ArangoDB server or list of server URLs.
agentOptions: {
maxSockets: 100,
keepAlive: true
},
loadBalancingStrategy: 'ROUND_ROBIN'
View index.js
"use strict";
const _ = require("lodash");
function groupByTimeWindow(start, end) {
return function(o) {
const date = new Date(o.timestamp);
if (date.getUTCHours() >= start && date.getUTCHours() <= end)
return o.consumption_Wh;
return 0;
@StarpTech
StarpTech / range-channels-backpressure.go
Created Jan 28, 2018
When a channel is closed sent messages are proceed until the "range" is closed
View range-channels-backpressure.go
package main
import (
"fmt"
"sync"
"time"
)
func main() {
var wg sync.WaitGroup
@StarpTech
StarpTech / range-channels.go
Created Jan 28, 2018
When a channel is closed all buffered and blocked messages are proceed until the "range is finish
View range-channels.go
package main
import (
"fmt"
"sync"
"time"
)
func main() {
var wg sync.WaitGroup
You can’t perform that action at this time.