Skip to content

Instantly share code, notes, and snippets.

View falexandre's full-sized avatar
😎

Fábio Luis Alexandre falexandre

😎
View GitHub Profile
@bingeboy
bingeboy / app.js
Last active April 29, 2021 15:52
Upload and display image with NodeJS and Express.
/*
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, user = require('./routes/user')
, common = require('./routes/common')
, fs = require('fs')
, http = require('http')
, util = require('util')
@eminetto
eminetto / gist:6512692
Created September 10, 2013 17:26
Vaga programador PHP na Coderockr
Requisitos
- Conhecimentos avançados em PHP e Orientação a Objetos
- Conhecimentos em algum framework como Zend Framework, Zend Framework 2 ou Symfony
- Interesse e facilidade em aprender novas tecnologias, linguagens de programação e ambientes de desenvolvimento
- Banco de dados como MySQL e PostgreSQL
- Inglês técnico, pelo menos para leitura
Requisitos adicionais
- HTML5, CSS3, Javascript (jQuery), Web standards
- Gostar de rock n’ roll!
@lucianobragaweb
lucianobragaweb / esconde.js
Last active January 31, 2023 21:28
Esconder elementos ao rolar a página.
// Script jQuery para esconder um elemento na página quando a rolagem ultrapassar 200px
$(window).scroll(function(){
if($(document).scrollTop() > 200){// se a rolagem passar de 200px esconde o elemento
$('#elementoAEsconder').hide();
} else { // senão ele volta a ser visivel
$('#elementoAEsconder').show();
@erans
erans / encrypt_decrypt_example.js
Last active October 14, 2022 02:31
Example of encryption and decryption in node.js
var crypto = require("crypto")
function encrypt(key, data) {
var cipher = crypto.createCipher('aes-256-cbc', key);
var crypted = cipher.update(data, 'utf-8', 'hex');
crypted += cipher.final('hex');
return crypted;
}
@pasupulaphani
pasupulaphani / after_res_hooks.js
Last active May 1, 2024 20:37
Mongoose connection best practices
var db = mongoose.connect('mongodb://localhost:27017/DB');
// In middleware
app.use(function (req, res, next) {
// action after response
var afterResponse = function() {
logger.info({req: req}, "End request");
// any other clean ups
@cletusw
cletusw / .eslintrc
Last active February 29, 2024 20:24
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@larikitty
larikitty / HighCharts-pt-BR-Translation.markdown
Last active April 6, 2017 11:13
HighCharts pt-BR Translation
@davideicardi
davideicardi / mongo-docker.bash
Last active July 16, 2023 18:18
Running mongodb inside a docker container (with mongodb authentication)
# Create a container from the mongo image,
# run is as a daemon (-d), expose the port 27017 (-p),
# set it to auto start (--restart)
# and with mongo authentication (--auth)
# Image used is https://hub.docker.com/_/mongo/
docker pull mongo
docker run --name YOURCONTAINERNAME --restart=always -d -p 27017:27017 mongo mongod --auth
# Using the mongo "localhost exception" (https://docs.mongodb.org/v3.0/core/security-users/#localhost-exception)
# add a root user
@p4tin
p4tin / Mongo.go
Created December 13, 2015 18:06
Golang Mongo CRUD Example
package mongo
import (
"time"
"log"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
// Profile - is the memory representation of one user profile
@lopezjurip
lopezjurip / Caddyfile
Last active June 24, 2017 22:18
Feathers.js + Docker + Caddy | SSL + HTTP2
your.domain.com {
proxy / web:3030 {
proxy_header Host {host}
proxy_header X-Real-IP {remote}
proxy_header X-Forwarded-Proto {scheme}
websocket
}
tls youremail@gmail.com
}