Skip to content

Instantly share code, notes, and snippets.

View nocdib's full-sized avatar

Greg Jay nocdib

View GitHub Profile
@haidarafif0809
haidarafif0809 / redis.js
Last active October 18, 2022 19:19
Redis Middleware using in nodejs express js.
const redis = require("redis");
const redis_url = process.env.REDIS_URL || null;
const client = redis.createClient(redis_url);
module.exports = {
getCached: (req, res, next) => {
const { redis_key } = req.headers
client.get(redis_key, function(err, reply) {
if (err) {
@santisbon
santisbon / Update-branch.md
Last active September 16, 2024 01:05
Deploying from #Git branches adds flexibility. Bring your feature branch up to date with master and deploy it to make sure everything works. If everything looks good the branch can be merged. Otherwise, you can deploy your master branch to return production to its stable state.

Updating a feature branch

First we'll update your local master branch. Go to your local project and check out the branch you want to merge into (your local master branch)

$ git checkout master

Fetch the remote, bringing the branches and their commits from the remote repository. You can use the -p, --prune option to delete any remote-tracking references that no longer exist in the remote. Commits to master will be stored in a local branch, remotes/origin/master.

@derekdowling
derekdowling / authenticator.go
Created October 11, 2014 19:44
Basic Password Handler for Go Apps/Websites
package authentication
// This will handle all aspects of authenticating users in our system
// For password managing/salting I used:
// http://austingwalters.com/building-a-web-server-in-go-salting-passwords/
import (
"code.google.com/p/go.crypto/bcrypt"
"crypto/rand"
"log"