forked from SAEBelgradeWeb/SAE-Cheatsheet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·157 lines (140 loc) · 6.07 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="assets/css/normalize.css" />
<link rel="stylesheet" href="assets/css/foundation.min.css" />
<link rel="stylesheet" href="assets/css/font-awesome.min.css" />
<link rel="shortcut icon" href="assets/ico/favicon.ico">
<link rel="stylesheet" href="assets/css/page.css" />
<meta name="description" content="SAE Cheat Sheet , Codes , shortcuts that students use">
<title>SAE Cheat Sheet</title>
</head>
<body>
<a href="#top" id="top-button" title="Top"><i class="icon-arrow-up"></i></a>
<div class="fixed">
<nav class="top-bar" data-topbar>
<ul class="title-area">
<li class="name"><h1><a href="#">SAE Cheat Sheet <small>v1.0.0</small></a></h1></li>
<li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li>
</ul>
<section class="top-bar-section">
<ul class="right">
<li class="comments-toggle"><a href="#"><i class="icon-comments"></i> Toggle Code Comments</a></li>
<li><a href="https://github.com/SAEBelgradeWeb/SAE-Cheatsheet" target="_blank"><i class="icon-github"></i> Github</a></li>
<li class="has-dropdown">
<a href="#">Valuable Links</a>
<ul class="dropdown">
<li>
<a href="https://github.com/SAEBelgradeWeb/" target="_blank"><i class="icon-github"></i> SAE GitHub</a>
</li>
<li>
<a href="http://belgrade.sae.edu" target="_blank"><i class="icon-file-text"></i> SAE Website</a>
</li>
</ul>
</li>
</ul>
</section>
</nav>
</div>
<a name="top" id="top-anchor"></a>
<div class="row" id="search-box">
<div class="small-10 small-offset-1 large-6 large-offset-3 columns">
<div class="row collapse">
<div class="small-10 columns">
<input type="text" placeholder="Start typing to search..." id="search" name="search" />
</div>
<div class="small-2 columns">
<button class="button postfix" id="search-button"><i class="icon-search"></i></button>
</div>
</div>
<small id="searchHint">hint: keep tapping the search, it scrolls to the result</small>
</div>
</div>
<div class="row full-width">
<div class="large-4 columns code-column">
<h4><a name="terminal" href="#terminal">Terminal</a></h4>
<pre class="prettyprint lang-php">
// Change directory
cd path/foldername
// Change drive on Windows
D:
// List all files in directory
ls [-l]
// Remove a directory with all the contents
rm -rf
// You can create a custom bash command by editing .bash_profile dotfile on Mac
nano ~/.bash_profile
// The syntax is as follows:
alias commandName="cd ~/Sites/srb-ag-website/frontend-src/"
// Oh wait, you can also create functions:
functionName() {
cd ~/Sites/SAE
mkdir jovan
sudo pfctl -f /etc/pf.conf
}
// But that is not all. You can use this to override default behavior of POSIX commands:
// 1. Always list directory contents when entering a dir.
// 2. Always enter a directory when you create it.
// 3. Shortcut to edit hosts file fast.
// 4. Clear DNS cache after editing hosts.
// 5. You can hijack brew commands to shorten them.
cd() { builtin cd "$@"; ls -l; }
mkdir() { command mkdir "$@"; cd "$@"; pwd; }
alias clear="clear && printf '\e[3J'"
alias hosts="sudo nano /etc/hosts"
alias hosts.cache="sudo killall -HUP mDNSResponder"
restart() { brew services restart "$@"; }
</pre>
More info on .bash_profile editing and custom commands: <a href="https://medium.com/homullus/bash-profile-bootcamp-7ddfd502d3ec" title="Custom Terminal Commands" target="_blank"><i class="icon-file-text"></i></a>
<h4><a name="shortcuts" href="#shortcuts">Shortcuts (Mac | Windows)</a></h4>
<pre class="prettyprint lang-php">
// Save file
CMD + S | CTRL + S
// Switch open windows
CMD + TAB | ALT + TAB
// Refresh window in browser
CMD + R | CTRL + R
// Hard refresh (clear cache) window in browser
CMD + SHIFT + R | CTRL + SHIFT + R
//Select all
CMD + A | CTRL + A
</pre>
</div>
<div class="large-4 columns code-column">
<h4><a name="git" href="#git">Git & Github</a> <a href="https://services.github.com/on-demand/downloads/github-git-cheat-sheet.pdf" title="Github Cheat Sheet" target="_blank"><i class="icon-file-text"></i></a></h4>
<pre class="prettyprint lang-php">
// Basic Git commit example
git add ./frontend-src/main.js
git commit -m"Replace ES5 with ES6/7 syntax"
git push
// Soft fetch all changes to all branches. Does not actually pull any code from git, just checks whether there were any changes upstream.
git fetch --all
// Git pull is always better with --rebase. But you must be careful that you do not have any non-pushed files. If so, use just `git pull`
git pull --rebase
// Show all git branches
git branch --all
// Completely reset the reporitory to the default state. Reset all changed files and clear all untracked files.
git reset --hard HEAD
git clean -xdf
//Force pull from GitHub - it will overwrite all local changes
git fetch --all
git reset --hard origin/master
</pre>
<p>
Gitignoring files after you have already pushed them: <a href="https://medium.com/homullus/gitignoring-files-after-committing-them-c37da0d9eb74" title="Gitignoring after push" target="_blank"><i class="icon-file-text"></i></a>
</p>
<p>
Connecting to GitHub with SSH keys: <a href="https://help.github.com/articles/connecting-to-github-with-ssh/" title="Connecting to GitHub with SSH keys" target="_blank"><i class="icon-file-text"></i></a>
</p>
</div>
<div class="large-4 columns code-column">
</div>
</div>
<script src="assets/js/jquery.js"></script>
<script src="assets/js/jquery.highlight-4.js"></script>
<script src="assets/js/foundation.min.js"></script>
<script src="assets/js/google-code-prettify/prettify.js"></script>
<script src="assets/js/app.js"></script>
</body>
</html>