Skip to content

Instantly share code, notes, and snippets.

View obedparla's full-sized avatar
👨‍💻
42

Obed Parlapiano obedparla

👨‍💻
42
View GitHub Profile
@hofmannsven
hofmannsven / README.md
Last active August 20, 2025 12:30
Git CLI Cheatsheet
@qiao
qiao / ip.js
Created January 17, 2012 11:27
Node.js get client IP address
// snippet taken from http://catapulty.tumblr.com/post/8303749793/heroku-and-node-js-how-to-get-the-client-ip-address
function getClientIp(req) {
var ipAddress;
// The request may be forwarded from local web server.
var forwardedIpsStr = req.header('x-forwarded-for');
if (forwardedIpsStr) {
// 'x-forwarded-for' header may return multiple IP addresses in
// the format: "client IP, proxy 1 IP, proxy 2 IP" so take the
// the first one
var forwardedIps = forwardedIpsStr.split(',');