- configure a CNAME record for the subdomain through digital ocean
| <?php | |
| // takes a start and end date as a string and returns the number of days | |
| // between them | |
| function diffInDays($start, $end) | |
| { | |
| $start = new DateTime($start); | |
| $end = new DateTime($end); | |
| return date_diff($start, $end)->days; | |
| } |
A common way to manage the versions of your files and content is to name files with increasing levels of description.
Example: Resume.pdf, Resume_Final.pdf, Resume_Final_Monday.pdf, Resume_FINAL_to_print.pdf, and Resume_print_before_interview.pdf
vs. a permanent record with a time machine that can enter paralell dimensions
- Git is a permanent record.
- Git is a time machine that allows us to travel through that permanent record.
- Git also allows us to travel into parallel universes (branches)
- GitHub is a service that hosts remote repositories.
| name | modifies the original? | return value | description |
|---|---|---|---|
push, unshift |
yes | the length of the new array | add element(s) to an array |
pop, shift |
yes | the element removed | remove an element from the beginning or end of an array |
reverse |
yes | the new array | reverses the array |
sort |
yes | the new array | sort the array |
splice |
yes | an array of deleted items | delete an |
| #!/bin/bash | |
| # will disable or enable a touchpad device | |
| TOUCHPAD_ID="$(xinput list | grep -oi 'touchpad\s*id=[0-9]\{1,\}' | grep -o '[0-9]\{1,\}')" | |
| ENABLED="$(xinput list-props $TOUCHPAD_ID | grep -i 'device enabled' | grep -o '[0-9]$')" | |
| if [ $ENABLED -eq 1 ]; then | |
| xinput disable $TOUCHPAD_ID | |
| echo "Touchpad disabled." |
Note: you will need a clean working directory to do this.
We will be rewriting history! This will entirely remove the commit from history
You should probably only do this if you really need to remove a file entirely from history. For example if the file you added is too large and GitHub won't accept it. If you are just trying to undo what a commit has done, there are better ways to do it without modifying history, check out git revert.
We are assuming that the problematic file was added in one commit and not modified since.
MySQL General error: 1215 Cannot add foreign key constraint
This will give you more details
echo 'show engine innodb status\G' | mysql -u homestead -p | grep -C10 -i latest
s/homestead/your username/
| fallocate -l 1G /swap | |
| mkswap /swap | |
| echo "/swap none swap sw 0 0" >> /etc/fstab | |
| swapon -ae |