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 / javascript-optimization-example.js
Created March 29, 2016 14:01
JavaScript optimization example using console.time
/**
* @link http://adripofjavascript.com
*/
// Example 1
(function(console) {
function factoral(num) {
if (num < 0) throw new Error('Bad input!');
if (num % 1 !== 0) throw new Error('That\'s NaN!');
if (num === 0 || num === 1) return 1;
@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
@jabranr
jabranr / xdebug-sublime-settings-template.json
Created February 3, 2016 09:36
Xdebug Sublime client settings template
{
"folders": [
{
"path": ".",
"follow_symlinks": true
}
],
"settings": {
"xdebug": {
"path_mapping": {
@jabranr
jabranr / sublime-linter-user-settings.json
Created February 3, 2016 09:29
Sublime Linter user settings
[
{ "keys": ["f4"], "command": "import_namespace" },
{ "keys": ["f7"], "command": "insert_php_constructor_property" },
{ "keys": ["f9"], "command": "expand_fqcn" },
{ "keys": ["f10"], "command": "find_use" },
{ "keys": ["shift+f9"], "command": "expand_fqcn", "args": {"leading_separator": true} },
{ "keys": ["shift+f12"], "command": "goto_definition_scope" }
]
@jabranr
jabranr / xdebug-sublime-settings.json
Created February 3, 2016 09:27
xDebug Sublime client user settings
{
"debug_layout" : {
"cols": [0.0, 0.5, 1.0],
"rows": [0.0, 0.6, 1.0],
"cells": [[0, 0, 2, 1], [0, 1, 1, 2], [1, 1, 2, 2]]
},
"close_on_stop": true,
"super_globals": true,
"break_on_start": false,
"debug": true
@jabranr
jabranr / delete-git-branch.sh
Created February 3, 2016 09:20
Delete a Git branch locally and remotely
# Delete a Git branch locally and remotely
# Author: Jabran Rafique <hello@jabran.me>
# License: MIT License
#!/bin/bash
# Display all local branches
git branch
# Delete a local branch
@jabranr
jabranr / setup-sshfs.sh
Last active February 25, 2016 18:28
Set up code tunnel using SSHFS between remote and host
# Mount volumes using SSHFS from a remote
# Author: Jabran Rafique <hello@jabran.me>
# License: MIT License
#!/bin/bash
sshfs {REMOTE}:{PATH} {HOST_PATH} -o follow_symlinks
@jabranr
jabranr / .gitconfig-default
Last active September 19, 2018 13:35
Default .gitconfig settings
[user]
name = Jabran Rafique
email = hello@jabran.me
[color]
ui = true
diff = auto
status = auto
branch = auto
@jabranr
jabranr / git-fetch-pull.sh
Last active December 10, 2015 10:31
Fetch and pull all Git directories in current directory
# Use the script at root directory of all Git projects.
#
# How it works:
# 1. The script will change directory to each sub directory.
# 2. Checks for ".git/" directory. Fails and returns message if not found.
# 3. In valid Git project, it Fetches and Pulls the updates from remote.
# 4. Shows end result message accordingly.
#
# Author: Jabran Rafique <hello@jabran.me>
# License: MIT License
@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"
]
}