Skip to content

Instantly share code, notes, and snippets.

View hadisinaee's full-sized avatar
:octocat:
I may be slow to respond.

Hadi hadisinaee

:octocat:
I may be slow to respond.
View GitHub Profile
@hadisinaee
hadisinaee / setup_avicenna_hugo.sh
Last active June 6, 2021 17:43
Setup a website with Avicenna theme
#!/bin/sh
SITE_FOLDER=$1
# creates the site folder
hugo new site $SITE_FOLDER
# install the latest avicenna theme
cd $SITE_FOLDER
git clone -b master git@github.com:hadisinaee/avicenna.git ./themes/avicenna
@hadisinaee
hadisinaee / protips.js
Created April 26, 2017 15:58 — forked from nolanlawson/protips.js
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@hadisinaee
hadisinaee / mongo_login_creator.sh
Last active March 24, 2018 12:20
Mongodb login creator with authentication. It is used for creating mongodb login scripts so that you easily can login into mongodb.
# declaring some colors for pretty output
declare -A colors=( ["g"]="\e[32m" ["r"]="\e[31m" ["y"]="\e[33m" ["b"]="\e[34m" ["m"]="\e[35m" ["c"]="\e[36m" ["default"]="\e[39m" )
declare -A sets=( ["b"]="\e[1m" ["d"]="\e[2m" ["u"]="\e[4m" ["bl"]="\e[5m")
declare -A resets=( ["b"]="\e[21m" ["d"]="\e[22m" ["u"]="\e[24m" ["bl"]="\e[25m")
# declare colorful echo
function echoc {
STRING_PRIFIX=''
if [ -n "$2" ]
@hadisinaee
hadisinaee / gitAlias.sh
Last active March 24, 2018 12:20
This gist shows my shortcuts to git. for those who use git for their daily life activities.
# git status, e.g: git st
git config --global alias.st status
# git status -s, e.g: git sts
git config --global alias.sts 'status -s'
# git commit, e.g: git ci
git config --global alias.ci commit
# git commit -m, e.g: git cim ""