-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands.txt
39 lines (30 loc) · 1.48 KB
/
commands.txt
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
GIT and GITHUB
git init -initialise a git repo
git add -adds changes to staged area
git commit -m "" -commits changes to local repository with comment
git reset file.txt -removes from staged area
git push -pushes local repo to remote repo on github
git push -u origin master -sets default upstream to origin master
git clone -clones github repo onto local
.gitignore -commit a file called .gitignore, list items to ignore inside - if you add 'a' will ignore all files with 'a' in it
ARRAYS
array.push('item') - adds item to the end of the array - << shovel notation (ruby only)
array.pop() - removes last item in the array, and also returns it (good for using and depleting array items)
array.shift() - removes first item in the array, and returns it
array.unshift('item') - adds item to the start of the array
array.insert(index, 'item') - adds item to index position in array, pushes the rest along
array.index('item') - returns the index of the specified item
array.delete('item') - removes all items equal to 'item'
array.delete_at(index) - removes item at specified index
array.length() - returns number of items in the array
array.count()
array.size()
HASHES
hash.key()
hash.value()
"key" => "value"
:key => "value"
key: "value"
Loops
break if - breaks if
for item in array -