Skip to content

Instantly share code, notes, and snippets.

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

Jaouad Ballat jaouadballat

🏠
Working from home
View GitHub Profile
@brianmacarthur
brianmacarthur / flash-app.js
Last active October 6, 2025 05:44
Flash messaging in Express 4: express-flash vs. custom middleware in ejs, handlebars, or jade
var express = require('express');
var cookieParser = require('cookie-parser');
var session = require('express-session');
var flash = require('express-flash');
var handlebars = require('express-handlebars')
var app = express();
var sessionStore = new session.MemoryStore;
// View Engines
@LeCoupa
LeCoupa / nodejs-cheatsheet.js
Last active December 18, 2025 17:39
Complete Node.js CheatSheet --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
/* *******************************************************************************************
* THE UPDATED VERSION IS AVAILABLE AT
* https://github.com/LeCoupa/awesome-cheatsheets
* ******************************************************************************************* */
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@raddeus
raddeus / app.js
Last active February 4, 2025 09:42
Basic Express 4.0 Setup with connect-flash
var express = require('express');
var session = require('express-session');
var cookieParser = require('cookie-parser');
var flash = require('connect-flash');
var app = express();
app.use(cookieParser('secret'));
app.use(session({cookie: { maxAge: 60000 }}));
app.use(flash());
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active December 26, 2025 10:04
A badass list of frontend development resources I collected over time.
@nicholashagen
nicholashagen / gist:1993769
Created March 7, 2012 15:22
Git Commands
# control color output via ASCII codes for better visual aspsect in terminal
git config --global color.ui auto
# update line-ending support for win/unix cross-platform (cr/cflf)
# force to be LF in the repo (regardless of OS)
git config --global core.autocrlf input
# force windows t oconvert to platform on checkout and back on commit
git config --global core.autocflf true
# individually control portions of a file (patch mode)
@xjamundx
xjamundx / express-pagination.js
Created April 19, 2011 05:28
sample pagination using express route-specific middleware
// articles per page
var limit = 10;
// pagination middleware function sets some
// local view variables that any view can use
function pagination(req, res, next) {
var page = parseInt(req.params.page) || 1,
num = page * limit;
db.articles.count(function(err, total) {
res.local("total", total);