Skip to content

Instantly share code, notes, and snippets.

@hadibadjian
hadibadjian / .clang-format
Created September 6, 2015 08:08
Clang-format Configuration File
---
Language: Cpp
AccessModifierOffset: 0
AlignEscapedNewlinesLeft: true
AlignTrailingComments: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: false
@hadibadjian
hadibadjian / http_status_code_sym.md
Last active August 29, 2015 14:26
Rails HTTP Status Code to Symbol Map

1xx Informational

Status Code Status Message Symbol
100 Continue :continue
101 Switching Protocols :switching_protocols
102 Processing :processing

2xx Success

Status Code Status Message Symbol
@hadibadjian
hadibadjian / rails-rspec-plugin.md
Last active August 29, 2015 14:22
Create Rails plugin to consume RSpec.

requires: bundler

  • Genarate a new plugin and change the default dummy app location to spec/dummy
rails plugin new foobar --dummy-path=spec/dummy
  • Add development and test gems to Gemfile.
# sample Gemfile
@hadibadjian
hadibadjian / .profile
Created March 1, 2015 03:14
.profile - bash configurations
# https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh
source ~/git-prompt.sh
# https://gist.github.com/hadibadjian
source ~/bash-short-pwd.sh
export PS1='$(__short_pwd)\[\033[32m\]$(__git_ps1 " (%s)")\[\033[00m\]$ '
LS_COLORS=$LS_COLORS:'di=0;35:fi=0;37:ln=0;37:pi=0;37:so=5:bd=5:cd=5:or=31:mi=0:ex=33:*.rpm=90'
export LS_COLORS
@hadibadjian
hadibadjian / bash-short-pwd.sh
Last active October 27, 2019 06:25
bash-short-pwd.sh - Fish shell inspired shortened PWD for shell prompt.
#!/bin/bash
# Modified from http://stackoverflow.com/a/1617048/359287
# By Hadi Badjian @hadibadjian
#
# Usage:
# source ~/bash-short-pwd.sh
# export PS1='$(__short_pwd)$ '
#
# Example:
# ~/p/y/b/docs$