Skip to content

Instantly share code, notes, and snippets.

View waldemirflj's full-sized avatar
😃
Happy

Waldemir Francisco waldemirflj

😃
Happy
View GitHub Profile
@sibelius
sibelius / groupBy.tsx
Created February 21, 2020 12:28
groupBy using reduce
const defaultGroupKey = (item) => item.id;
const groupBy = <T extends any)(arr: Array<T>, groupKeyFn = defaultGroupKey) => {
return arr.reduce((acc, item) => {
const key = groupKeyFn(item);
if (key in acc) {
return {
...acc,
[key]: [...acc[key], item],
@tomhicks
tomhicks / plink-plonk.js
Last active March 18, 2024 02:23
Listen to your web pages
@NigelEarle
NigelEarle / Knex-Setup.md
Last active May 4, 2024 13:36
Setup Knex with Node.js

Knex Setup Guide

Create your project directory

Create and initialize your a directory for your Express application.

$ mkdir node-knex-demo
$ cd node-knex-demo
$ npm init
@SanderTheDragon
SanderTheDragon / postman-deb.sh
Last active April 3, 2024 05:30
A shellscript to create a Postman .deb file, for simple installation on Debian-based Linux distro's. Also creates a .desktop file.
#!/bin/sh
# SPDX-FileCopyrightText: 2017-2022 SanderTheDragon <sanderthedragon@zoho.com>
#
# SPDX-License-Identifier: MIT
curlExists=$(command -v curl)
echo "Testing Postman version"
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 10, 2024 12:56
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@Woodsphreaker
Woodsphreaker / info.md
Last active April 3, 2017 04:18
Ordenar objeto por vários campos

Ordernar um objeto com vários itens por determinados campos

Ordena dados por campos.

Casos de uso

sorting(names, ['name', 'age'], ASC)

Ordena o objeto names pelos campos name e age por direção Ascendente
@mxstbr
mxstbr / Readme.md
Last active December 20, 2023 12:01
Enable tab completion for JSX with Emmet in Atom

Enable tab completion for JSX with Emmet in Atom

This guide assumes you have the emmet and language-babel packages already installed in Atom

Gif of the tab completion working

  1. Open the keymap.cson file by clicking on Atom -> Keymap… in the menu bar
  2. Add these lines of code to your keymap:
'atom-text-editor[data-grammar~="jsx"]:not([mini])':
@hertz1
hertz1 / removerAcentos.js
Last active September 29, 2022 16:21
Função simples e eficiente para remover todos os tipos de acentos da língua portuguesa.
/**
* Remove acentos de strings
* @param {String} string acentuada
* @return {String} string sem acento
*/
var map={"â":"a","Â":"A","à":"a","À":"A","á":"a","Á":"A","ã":"a","Ã":"A","ê":"e","Ê":"E","è":"e","È":"E","é":"e","É":"E","î":"i","Î":"I","ì":"i","Ì":"I","í":"i","Í":"I","õ":"o","Õ":"O","ô":"o","Ô":"O","ò":"o","Ò":"O","ó":"o","Ó":"O","ü":"u","Ü":"U","û":"u","Û":"U","ú":"u","Ú":"U","ù":"u","Ù":"U","ç":"c","Ç":"C"};
function removerAcentos(s){ return s.replace(/[\W\[\] ]/g,function(a){return map[a]||a}) };
@soheilhy
soheilhy / nginxproxy.md
Last active May 8, 2024 09:56
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@cirocosta
cirocosta / MANUSEANDO-ARQUIVOS.md
Last active July 22, 2022 19:57
Manuseando Arquivos com Nodejs

Manuseando arquivos com compabilidade entre SOs

Criar Pastas

Para criação de pastas o mais conveniente (unix) é utilizar mkdir -p, o qual:

-p, --parents no error if existing, make parent directories as needed

tem-se então o semelhante como módulo de node, o mkdirp.