Skip to content

Instantly share code, notes, and snippets.

View mort3za's full-sized avatar
🕸️

Morteza Ziyaeimehr mort3za

🕸️
View GitHub Profile
@mort3za
mort3za / add-a-folder-to-system-path-in-ubuntu.txt
Last active May 21, 2016 08:26
Add folder to path in ubuntu. #linux
run this command:
sudo gedit ~/.bashrc
then add this line to the end of file:
export PATH=$PATH:/the/folder/of/your/app/bin
save file and exit gedit.
run this command:
source .bashrc
and re-open a new terminal to test your app
# just install git for windows.
ssh -v to see if ssh client is installed.
ssh-keygen
# it will generate two files (id_rsa => private key, id_rsa.pub => public key).
# add contents of id_rsa.pub to bitbucket->account->ssh-keys
# create a project in bitbucket.org
# run commands of overview page (git init, ...)
# done.
@mort3za
mort3za / install-font-in-ubuntu.txt
Last active May 21, 2016 08:28
install new fonts ubuntu. #linux
sudo cp ~/Desktop/my-new-fonts /usr/share/fonts/truetype/ -r
fc-cache -f -v
@mort3za
mort3za / install-nodejs-bower-gulp.bash
Last active September 6, 2016 07:09
Installing bower, gulp, npm, nodejs on ubuntu. #linux
# First install 'nodejs' (not node, and don't use apt install nodejs, because it's not latest version).
# https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
# and then npm (if it's not installed automatically):
# https://rtcamp.com/tutorials/nodejs/node-js-npm-install-ubuntu/
# Then install bower and gulp with simple npm install command (with -g flag).
# For accessing bower in global space (or adding it to path) create a symbolic link:
<VirtualHost *:80>
DocumentRoot /opt/lampp/htdocs/path/to/project/folder
ServerName mynewhost.com
ServerAlias *.mynewhost.com
</VirtualHost>
# Also add: 127.0.0.1 mynewhost.com to hosts file.
@mort3za
mort3za / iran-states-cities.json
Created July 3, 2017 16:41
Iran cities and states in json format
{
"result": {
"states": [
"آذربایجان شرقی",
"آذربایجان غربی",
"اردبیل",
"اصفهان",
"البرز",
"ایلام",
"بوشهر",
@mort3za
mort3za / var_dump-better-view-snippet-for-atom.cson
Last active August 14, 2017 14:23
Better view/style for var_dump in php [Snippet for Atom editor]
# snippet for Atom editor:
'.source.php':
'Styled var_dump':
'prefix': 'vardumper'
'body': 'echo "<pre style=\'word-spacing:15px; line-height:1.5; font-size:18px;\'>";var_dump($1);echo"</pre>";'
# output is this:
# echo "<pre style='word-spacing:15px; line-height:1.5; font-size:18px;'>";var_dump($request);echo"</pre>";
@mort3za
mort3za / debugging.md
Created February 15, 2018 08:20
How to debug nodejs applications?

Nodejs debugging:

node inspect app.js
type in console: c (continue to end), n (next expression), repl (go into repl mode and do modifications or log), list(10) to see 10 lines of code.
type debugger; inside code (similar to breakpoint)


Nodejs debug with chrome-dev-tools:

nodemon inspect-brk app.js
go to chrome://inspect
click to open dedicated devtools for Nodejs

@mort3za
mort3za / cdn-jquery-angular-with-fallback
Last active April 10, 2018 02:23
Loading jQuery and AngularJS from CDN with local fallback
<script src='http://code.jquery.com/jquery-latest.min.js' type='text/javascript'></script>
<script src='//ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js' type='text/javascript'></script>
<script type="text/javascript">
// Fallbacks
window.jQuery || document.write(unescape("%3Cscript src='js/vendor/jquery.min.js' type='text/javascript'%3E%3C/script%3E"));
window.angular || document.write(unescape("%3Cscript src='js/vendor/angular.min.js' type='text/javascript'%3E%3C/script%3E"));
</script>