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
@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);
@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)
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active November 20, 2024 12:53
A badass list of frontend development resources I collected over time.
@raddeus
raddeus / app.js
Last active September 14, 2024 17:23
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());
@LeCoupa
LeCoupa / nodejs-cheatsheet.js
Last active November 23, 2024 08:05
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
@brianmacarthur
brianmacarthur / flash-app.js
Last active September 14, 2024 17:22
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
@thebigredgeek
thebigredgeek / express_with_jwt.js
Last active November 5, 2023 18:35
Express API with JWT
var express = require('express')
, jwtMiddleware = require('express-jwt')
, bodyParser = require('body-parser')
, cookieParser = require('cookie-parser')
, cors = require('cors');
// We pass a secret token into the NodeJS process via an environment variable.
// We will use this token to sign cookies and JWTs
var SECRET_TOKEN = process.env.SECRET_TOKEN;
@ivanvermeyen
ivanvermeyen / !NOTE.md
Last active March 15, 2023 05:25
Setup a Laravel Storage driver with Google Drive API
@jacurtis
jacurtis / 1) Main.blade.php
Created February 16, 2017 16:37
Laravel 5.4 Components & Slots
<!-- This is the main Blade file that you want your components to show up in -->
<!DOCTYPE html>
<html lang="{{ config('app.locale') }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
@jaouadballat
jaouadballat / frontendDevlopmentBookmarks.md
Created May 20, 2017 20:08 — forked from dypsilon/frontendDevlopmentBookmarks.md
A badass list of frontend development resources I collected over time.