Skip to content

Instantly share code, notes, and snippets.

View olvresc's full-sized avatar
💭
I may be slow to respond.

olvresc olvresc

💭
I may be slow to respond.
View GitHub Profile
@robmathers
robmathers / groupBy.js
Created October 25, 2018 23:18
A more readable and annotated version of the Javascript groupBy from Ceasar Bautista (https://stackoverflow.com/a/34890276/1376063)
var groupBy = function(data, key) { // `data` is an array of objects, `key` is the key (or property accessor) to group by
// reduce runs this anonymous function on each element of `data` (the `item` parameter,
// returning the `storage` parameter at the end
return data.reduce(function(storage, item) {
// get the first instance of the key by which we're grouping
var group = item[key];
// set `storage` for this instance of group to the outer scope (if not empty) or initialize it
storage[group] = storage[group] || [];
@rmoff
rmoff / docker-compose.yml
Last active April 29, 2024 12:40
Docker-Compose for Kafka and Zookeeper with internal and external listeners
---
version: '2'
services:
zookeeper:
image: confluentinc/cp-zookeeper:latest
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
kafka:
@bradtraversy
bradtraversy / webdev_online_resources.md
Last active April 30, 2024 17:23
Online Resources For Web Developers (No Downloading)
@gokulkrishh
gokulkrishh / media-query.css
Last active April 26, 2024 10:32
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
@tux4
tux4 / axios-test.js
Last active September 22, 2022 12:43
Jest mock for axios.js
/* Jest test of axios XHR calls */
describe('axios', function() {
var axios;
beforeEach(function() {
axios = require('axios');
});
pit('successful mock HTTP request', function() {
var reqP = axios