This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The Ruby system method is the simplest way to run an external command. | |
https://stackoverflow.com/questions/307070/how-do-you-spawn-a-child-process-in-ruby | |
system("ls") | |
Notice that system will print the command output as it happens. | |
Also system will make your Ruby program wait until the command is done. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :api do | |
namespace :v1 do | |
end | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in database.yml change socket to below value and might need to change pool | |
default: &default | |
adapter: mysql2 | |
encoding: utf8 | |
pool: 5 | |
min_messages: warning | |
timeout: 5000 | |
username: root | |
password: root | |
socket: /var/run/mysqld/mysqld.sock |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Quit MAMP. | |
In the finder go to Applications/MAMP/db/mysql/ and delete the last log file (look for a file named ib_logfileN – being N the log number). Please back up these before you delete them 🙂 | |
Restart MAMP. | |
Also, can type: | |
killall -9 mysqld | |
in terminal to make sure multiple instances are not running. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# list comprehension | |
my_list = [param for param in 'hello'] | |
my_list2 = [num for num in range(0,100)] | |
print(my_list2) | |
my_list3 = [num*2 for num in range(0,100)] | |
print(my_list3) | |
my_list4 = [num**2 for num in range(0,100) if num %2 ==0] | |
print(my_list4) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
colorhexa.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this is because you are using php-fpm. | |
so, after changing /etc/php.ini, you need to run | |
systemctl restart httpd | |
systemctl restart php-fpm | |
you can also create a file in your website.com directory called phpinfo.php and add the following code in it: | |
<?php phpinfo(); ?> | |
this will show you what ini & path you're using. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simplest form: | |
<%= link_to "Home", root_path %> | |
#is the same as: <a href="/">Home</a> | |
# Linking to a resource: | |
<%= link_to "Profile", user_path(@user) %> | |
# => <a href="/users/1">Profile</a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
weather = "It\'s \"kind of\" sunny \t tabbed \n new line" | |
print(weather) | |
# => It's "kind of" sunny tabbed | |
# => new line | |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./gitup.sh | |
./fixsite.rb | |
touch tmp/restart.txt |