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
jabranr / prepare-commit-msg.sh
Last active Jun 20, 2016
PUT a JIRA ticket numebr into commit message
View prepare-commit-msg.sh
# Save in .git/hooks/prepare-commit-msg
#
# This means that current branch was branched
# out from JIRA/Bitbucket and has a JIRA
# ticket number in its name.
JIRA=$(cat .git/HEAD | grep -Eo "[A-Z]+-[0-9]+")
echo "$JIRA" >> "$1"
@jabranr
jabranr / sublime_custom_getter_setter.py
Last active Jun 19, 2016
Sublime custom template for PHP Getters and Setters package
View sublime_custom_getter_setter.py
# Save the file to "{Sublime Packages}/PHP Getters and Setters/user_templates.py"
# Then add following "user config" in Sublime Text:
#
# {
# "registerTemplates" : [ "customTemplate" ],
# "template" : "customTemplate"
# }
#
# Restart Sublime Text
#
View .editorconfig
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@jabranr
jabranr / mysql_backup_cron.sh
Last active Aug 21, 2019
Automatic MySQL dump and backup to Git repo cron job
View mysql_backup_cron.sh
#!/bin/sh
#
# @author: Jabran Rafique <hello@jabran.me>
# @link: http://jabran.me/articles/automatic-database-backup-using-git-hosting/
# Set variables
FULLDATE = $(date +"%Y-%d-%m %H:%M")
NOW = $(date +"%Y-%m-%d-%H-%M")
MYSQL_DUMP = `which mysqldump`
GIT = `which git`
@jabranr
jabranr / php-get-set.sublime-snippet
Created Apr 1, 2016
Autogenerate PHP getters setters
View php-get-set.sublime-snippet
<snippet>
<content><![CDATA[
/**
* Get ${1/(.*)/\u$1/:[ Prop name ]}
* ${4:[description]}
*
* @return ${3:[type]}
*/
public function get${1/(.*)/\u$1/:[ Prop name ]}() {
return \$this->${1:[ Prop name ]};
@jabranr
jabranr / javascript-optimization-example.js
Created Mar 29, 2016
JavaScript optimization example using console.time
View javascript-optimization-example.js
/**
* @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 Dec 9, 2016
Git helpers commands
View git-helpers.sh
# 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 Feb 3, 2016
Xdebug Sublime client settings template
View xdebug-sublime-settings-template.json
{
"folders": [
{
"path": ".",
"follow_symlinks": true
}
],
"settings": {
"xdebug": {
"path_mapping": {
View sublime-linter-user-settings.json
[
{ "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 Feb 3, 2016
xDebug Sublime client user settings
View xdebug-sublime-settings.json
{
"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
You can’t perform that action at this time.