Skip to content

Instantly share code, notes, and snippets.

View jabranr's full-sized avatar
🚀
Building ideas

Jabran Rafique jabranr

🚀
Building ideas
View GitHub Profile
@jabranr
jabranr / README.md
Created July 28, 2018 09:01 — forked from jonathantneal/README.md
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\ Text.app/Contents/SharedSupport/bin/subl"
@jabranr
jabranr / test.js
Created May 23, 2018 17:08 — forked from mscdex/test.js
sharing sessions between node.js and php using redis
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
jabranr / config
Last active April 10, 2018 13:08
ssh config boilerplate
# Save following to ~/.ssh/config
Host {work}.bitbucket.com
HostName {work}.bitbucket.com
IdentityFile ~/.ssh/{work}
Host bitbucket.org
HostName bitbucket.org
IdentityFile ~/.ssh/personal
Host github.com
@jabranr
jabranr / vimrc
Last active September 25, 2017 12:32
.vimrc file
" Inspired from https://dougblack.io/words/a-good-vimrc.html
" Enable syntax colors
syntax enable
" Set line numbers
set number
set relativenumber
" Set tabs and spaces
@jabranr
jabranr / distance.js
Last active September 17, 2017 09:05
(Math) Find distance between two known points
// 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
jabranr / loop.js
Last active September 17, 2017 09:04
(Math) Generate a loop with maximum range
// Increase until a range is met then start again:
let range = 10;
let x = (x + 1) % range;
@jabranr
jabranr / Cache.js
Last active January 5, 2017 17:43
[JavaScript] Cache data in memory
/**
* This snippet is now a small library!
* @link https://github.com/jabranr/js-memcache
*/
@jabranr
jabranr / default-sublime-packages.json
Last active December 9, 2016 01:03
Default Sublime packages
{
"packages":
[
"Emmet", "Git", "Material Theme", "Package Control",
"PHP Campanion", "Pyv8", "SCSS", "Theme - Cobalt2",
"Twig", "Xdebug Client", "Git Gutter", "Pretty JSON",
"SidebarEnhancements", "PHP Getters Setters"
]
}
@jabranr
jabranr / sublime-settings.json
Last active December 9, 2016 00:59
Personal Sublime preferences
{
"bold_folder_labels": true,
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"draw_centered": false,
"fade_fold_buttons": false,
"file_exclude_patterns":
[
"*.pyc",
"*.pyo",
"*.exe",
@jabranr
jabranr / git-helpers.sh
Last active December 9, 2016 00:50
Git helpers commands
# Get own stats for the day
git diff --shortstat "@{0 day ago}"
# Get contributor stats
git shortlog -sn