Skip to content

Instantly share code, notes, and snippets.

View shadowlik's full-sized avatar
divide and conquer

Henrique Marques Fernandes shadowlik

divide and conquer
View GitHub Profile

Remove $decimal from express json response

Simple but effective way to remove recursively all the annoying $decimal key when using res.json.

It's a simple regex that cleans the response object as a json before sending.

@abn
abn / slugify.postgres.sql
Last active March 14, 2024 20:29
A slugify function for postgres
-- original source: https://medium.com/adhawk-engineering/using-postgresql-to-generate-slugs-5ec9dd759e88
-- https://www.postgresql.org/docs/9.6/unaccent.html
CREATE EXTENSION IF NOT EXISTS unaccent;
-- create the function in the public schema
CREATE OR REPLACE FUNCTION public.slugify(
v TEXT
) RETURNS TEXT
LANGUAGE plpgsql
@asoorm
asoorm / docker-compose-mongo-replicaset.yml
Created September 14, 2018 19:00
Mongo Replica Set docker compose
version: "3"
services:
mongo1:
hostname: mongo1
container_name: localmongo1
image: mongo:4.0-xenial
expose:
- 27017
ports:
- 27011:27017
kubectl get pods | grep Evicted | awk '{print $1}' | xargs kubectl delete pod
@sdieunidou
sdieunidou / rabbitmq.txt
Created October 22, 2015 19:51
create admin user on rabbitmq
rabbitmqctl add_user test test
rabbitmqctl set_user_tags test administrator
rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
@glauckner
glauckner / GIT DB Export Hook
Created June 6, 2013 16:15
Git pre commit hook to export database
#!/bin/bash
DBUSER="root"
DBPASS=""
DB="wordpress_bio"
SCHEMAPATH="__sql"
if [ ! -d "$SCHEMAPATH" ]; then
mkdir $SCHEMAPATH
fi
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//