Skip to content

Instantly share code, notes, and snippets.

View MarcoAlejandro's full-sized avatar
🏠
Working from home

Marco Alejandro MarcoAlejandro

🏠
Working from home
View GitHub Profile
@MarcoAlejandro
MarcoAlejandro / README-Template.md
Created September 26, 2019 17:12 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@MarcoAlejandro
MarcoAlejandro / .css
Last active June 5, 2019 11:54
css-sheet
/*====================================0
CSS RESET
*======================================/
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
@MarcoAlejandro
MarcoAlejandro / auth.js
Created December 26, 2018 11:19
Authentication recipe in expressjs
//authentication middleware.
function auth(req, res, next) {
console.log(req.headers);
var authHeader = req.headers.authorization;
if(!authHeader) {
var err = new Error('You are not authenticated');
res.setHeader("WWW-Authenticate", 'Basic');
err.status = 401;
next(err);
}
@MarcoAlejandro
MarcoAlejandro / mongo-model.js
Created December 26, 2018 08:22
Mongoose model recipe.
//https://mongoosejs.com/docs/guide.html
const mongoose = require('mongoose')
const Schema = mongoose.Schema;
var commentSchema = new Schema({
rating: {
type: Number,
min: 1,
max: 5,
required: true
@MarcoAlejandro
MarcoAlejandro / router.js
Created December 19, 2018 02:34
Expressjs recipes.
//https://expressjs.com/en/guide/routing.html
//Always is better to user express.Router to modularize routing in your app.
var express = require('express')
var router = express.Router()
// middleware that is specific to this router
router.use(function timeLog (req, res, next) {
console.log('Time: ', Date.now())
next()
})
@MarcoAlejandro
MarcoAlejandro / .txt
Last active September 24, 2018 01:07
slack direct references!
Slack Event API event types: https://api.slack.com/events/api
Is an excellent idea to use WEB + Events API's:
https://api.slack.com/events-api#the_event_loop
https://api.slack.com/web
Attachements. https://api.slack.com/docs/message-attachments
buttons: https://api.slack.com/docs/message-buttons
bot-users: https://api.slack.com/bot-users
@MarcoAlejandro
MarcoAlejandro / .txt
Created September 18, 2018 23:27
OAuth reference
OAuth videos explanation.
https://www.youtube.com/watch?v=LRNg4tDtrkE&list=PL675281900139F609
@MarcoAlejandro
MarcoAlejandro / .txt
Created July 17, 2018 19:35
Upload new local branch to new remote branch
https://stackoverflow.com/questions/2765421/how-do-i-push-a-new-local-branch-to-a-remote-git-repository-and-track-it-too