Skip to content

Instantly share code, notes, and snippets.

Developing ideas

Jabran Rafique⚡️ jabranr

Developing ideas
Block or report user

Report or block jabranr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jabranr /
Last active Aug 21, 2019
Automatic MySQL dump and backup to Git repo cron job
# @author: Jabran Rafique <>
# @link:
# Set variables
FULLDATE = $(date +"%Y-%d-%m %H:%M")
NOW = $(date +"%Y-%m-%d-%H-%M")
MYSQL_DUMP = `which mysqldump`
GIT = `which git`
View .gitignore_global
jabranr / .gitconfig-default
Last active Sep 19, 2018
Default .gitconfig settings
View .gitconfig-default
name = Jabran Rafique
email =
ui = true
diff = auto
status = auto
branch = auto
jabranr /
Created Jul 28, 2018 — forked from jonathantneal/
Local SSL websites on macOS Sierra

Local SSL websites on macOS Sierra

These instructions will guide you through the process of setting up local, trusted websites on your own computer.

These instructions are intended to be used on macOS Sierra, but they have been known to work in El Capitan, Yosemite, Mavericks, and Mountain Lion.

NOTE: You may substitute the edit command for nano, vim, or whatever the editor of your choice is. Personally, I forward the edit command to Sublime Text:

alias edit="/Applications/Sublime\"
jabranr / test.js
Created May 23, 2018 — forked from mscdex/test.js
sharing sessions between node.js and php using redis
View test.js
var express = require('express'),
app = express(),
cookieParser = require('cookie-parser'),
session = require('express-session'),
RedisStore = require('connect-redis')(session);
app.use(express.static(__dirname + '/public'));
app.use(function(req, res, next) {
if (~req.url.indexOf('favicon'))
return res.send(404);
jabranr / config
Last active Apr 10, 2018
ssh config boilerplate
View config
# Save following to ~/.ssh/config
Host {work}
HostName {work}
IdentityFile ~/.ssh/{work}
IdentityFile ~/.ssh/personal
jabranr / image-aspect-ratio.js
Last active Nov 15, 2017
Set image aspect ratio with JavaScript
View image-aspect-ratio.js
* Originally wrote this snippet for Suffragette/Pathé campaign (
* The campaign app forms a grid of square images pulled from social APIs based on
* particular hashtags. This snippet sets the new width and
* height based on their natural width and height to maintain the aspect ratio.
* Works best for 1:1 aspect ratio but can be modified to accommodate other ratio.
* @param Element|Resource img - An image element/resource from DOM
* @param int expected - Expected width or height
jabranr / vimrc
Last active Sep 25, 2017
.vimrc file
View vimrc
" Inspired from
" Enable syntax colors
syntax enable
" Set line numbers
set number
set relativenumber
" Set tabs and spaces
jabranr / distance.js
Last active Sep 17, 2017
(Math) Find distance between two known points
View distance.js
// Point a1
// Point a2
let dx = a2.x - a1.x;
let dy = a2.y - a1.y;
let distance = Math.sqrt(dx*dx + dy*dy);
jabranr / loop.js
Last active Sep 17, 2017
(Math) Generate a loop with maximum range
View loop.js
// Increase until a range is met then start again:
let range = 10;
let x = (x + 1) % range;
You can’t perform that action at this time.