Skip to content

Instantly share code, notes, and snippets.

View hugojerez's full-sized avatar
🤓
Deus ex machina

Hugo Jerez hugojerez

🤓
Deus ex machina
  • Santiago, Chile
View GitHub Profile
@laterbreh
laterbreh / Express 4 and Socket.io: Passing socket.io to routes - app.js
Last active August 15, 2023 13:58
Express 4 and Socket.io: Passing socket.io to routes.
var app = express();
app.io = require('socket.io')();
var routes = require('./routes/index')(app.io);
app.use('/', routes);
@kottenator
kottenator / simple-pagination.js
Created July 13, 2015 20:44
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;