-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.html
executable file
·265 lines (222 loc) · 10.3 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
<!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
<h4>Sublime Text 3 Additional Shortcuts (Windows | Mac)</h4>
// Select Line
CTRL + L | CMD + L
// Select Word
CTRL + D | CMD + D
// Multi Select Editing
CTRL + CLICK | CMD + CLICK
// Layout Column Num.
ALT + SHIFT + 1/4 | CMD + ALT + 1/4
// Find
CTRL + F | CMD + F
// Replace
CTRL + H | CMD + ALT + F
// Comment/Uncomment Line
CTRL + / | CMD + /
// Block Comment
CTRL + SHIFT + / | CMD + ALT + /
// Indent Current Line
CTRL + ] | CMD + ]
// Unindent Current Line
CTRL + [ | CMD + [
// Paste with Proper Indentation
CTRL + SHIFT + V | CMD + SHIFT + V
// Duplicate Line(s)
CTRL + SHIFT + D | CMD + SHIFT + D
</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
// Git Reflog is a real life-saver. When working on project with multiple people, it is not that hard to erase history or reset the wrong commits. Git Reflog is a local history of changes stored on your computer. So even if you push something that you shouldn't, you can simply ask reflog to return to the previous state - like a safety net.
// Issue the reflog command, and try to find a hash that matches with the previous state.
git reflog
git reset --hard $HASH
git push -f
// Git interactive rebase allows you to retroactively change history up until a certain point.
git rebase -i $HASH
</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">
<h4><a name="laravel" href="#laravel">Laravel</a></h4>
<pre class="prettyprint lang-php">
// Download Laravel Installer using Composer
composer global require "laravel/installer"
// Create fresh Laravel installation in the directory you specify. In this case directory named blog will be created and it will contain fresh Laravel installation with all of Laravel's dependencies alredy installed.
laravel new blog
// View a list of all available Artisan commands.
php artisan
// Interact with your entire Laravel application via command line using Tinker.
php artisan tinker
// Run database migrations.
php artisan migrate
// Rollback the last database migration (undo the last database migration).
php artisan migrate:rollback
// Drop all tables and re-run all migrations.
php artisan migrate:fresh
// Create migration. In this example create_posts_table is the name of the migration and --create option indicates that this migration will be creating a new table called posts.
php artisan make:migration create_posts_table --create=posts
// Create migration. In this example add_categories_to_posts_table is the name of the migration and --table option indicates the name of the table where categories will be added.
php artisan make:migration add_categories_to_posts_table --table=posts
// Create a Model instance. In this example Post is the name of the model.
php artisan make:model Post
// Create a Model instance and generate a database migration when the Model is generated.
php artisan make:model Post -m
// Create a new seeder class.
php artisan make:seeder
// Seed the database.
php artisan db:seed
// Seed the database. In this example --class option specifies a specific seeder class to run individually.
php artisan db:seed --class=PostTableSeeder
// Seed the database while also running a migrate:fresh, which will drop all of the tables and re-run all of migrations.
php artisan migrate:fresh --seed
</pre>
<h4><a name="composer" href="#composer">Composer</a></h4>
<pre class="prettyprint lang-php">
// Adds required packages to your composer.json and installs them.
composer require vendor-name/package-name
// Parses the composer.json file and downloads the needed dependencies.
composer install
// Updates your dependencies to the latest version, and updates the composer.lock file.
composer update
// In case you get a warning message: "The lock file is not up to date..." you can just run the update --lock command to update the lock file without upgrading any vendors.
composer update --lock
// If you need to update the autoloader because of new classes in a classmap package for example, you can use "dump-autoload" to do that without having to go through an install or update.
composer dump-autoload
// Use --optimize to convert PSR-0/4 autoloading to classmap to get a faster autoloader. This is strongly recommended for production (you can get a 20% boost), but can take a bit of time to run so it is currently not done by default.
composer dump-autoload --optimize
// Use to update composer
composer self-update
</pre>
</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>