Skip to content

Instantly share code, notes, and snippets.

View farhang's full-sized avatar
🏠
Working from home

Farhang Darzi farhang

🏠
Working from home
View GitHub Profile
@farhang
farhang / semantic-commit-messages.md
Created November 11, 2020 11:27 — forked from joshbuchea/semantic-commit-messages.md
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@farhang
farhang / std.md
Created November 11, 2020 11:27 — forked from turbo/std.md
Git Commit Message Standard

Merged from https://github.com/joelparkerhenderson/git_commit_message and https://chris.beams.io/posts/git-commit/

General Rules

  • Commit messages must have a subject line and may have body copy. These must be separated by a blank line.
  • The subject line must not exceed 50 characters
  • The subject line should be capitalized and must not end in a period
  • The subject line must be written in imperative mood (Fix, not Fixed / Fixes etc.)
  • The body copy must be wrapped at 72 columns
  • The body copy must only contain explanations as to what and why, never how. The latter belongs in documentation and implementation.
@farhang
farhang / openconnect bash alias
Created October 14, 2020 21:58
openconnect bash alias
alias cvpn="echo 'PASSWORD' | sudo openconnect --passwd-on-stdin --reconnect-timeout 1 --servercert sha256:<FINGERPRINT> --authgroup <AUTHGROUP> --user <USER_NAME> <HOST>:<PORT"
@farhang
farhang / password-regular-expression.js
Created October 30, 2019 10:37
JavaScript regular expression password (at least one lower case letter and one upper case letter and one number or regular expression
/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-z])(?=.*[a-z]).*$/
@farhang
farhang / bootstrap-all.scss
Last active October 7, 2019 11:28
Bootstrap SCSS files to import
// Custom variables and bootstrap overrides
@import './assets/styles/variables';
// Bootstrap
@import '~bootstrap/scss/functions';
@import '~bootstrap/scss/variables';
@import '~bootstrap/scss/mixins';
@import '~bootstrap/scss/root';
@import '~bootstrap/scss/reboot';
@import '~bootstrap/scss/type';
@farhang
farhang / angular-github-pages-travis.yml
Created September 25, 2019 05:54
deploy angular project to github pages using travis CI
dist: xenial
sudo: false
language: node_js
node_js:
- "10"
cache:
directories:
- ./node_modules
@farhang
farhang / Type checking on objects
Last active June 26, 2019 12:34
Angular Snippets
export type SortDirection = 'asc' | 'desc' | '';
const rotate: {[key: string]: SortDirection} = { asc: 'desc', desc: '', '': 'asc' };
@farhang
farhang / Bootstrap-table-rounded.css
Last active April 12, 2019 18:30
Bootstrap rounded corner border
.table-rounded thead th {
border: none;
}
.table-rounded thead th:first-child {
border-radius: $border-radius 0 0 0;
}
.table-rounded thead th:last-child {
border-radius: 0 $border-radius 0 0;
}
function jobCreator(jobTitle) {
return function(prefix) {
return prefix + ' ' + jobTitle;
};
}
var marketer = jobCreator('Marketer');
var developer = jobCreator('Developer');
console.log(marketer('Head')); // Head Marketer
function jobCreator(jobTitle) {
return function(prefix) {
return prefix + ' ' + jobTitle;
};
}
var marketer = jobCreator('Marketer');
var developer = jobCreator('Developer');
console.log(marketer('Head')); // Head Marketer