This file contains 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
$ rails console -h | |
Usage: console [environment] [options] | |
-s, --sandbox Rollback database modifications on exit. | |
--debugger Enable ruby-debugging for the console. | |
--irb DEPRECATED: Invoke `/your/choice/of/ruby script/rails console` instead |
This file contains 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
#!/bin/bash | |
# MySQL connection | |
user_name="your_user_name" | |
db_name="your_db_name" | |
# Return the result of the query to a variable | |
result=$(mysql -u $user_name $db_name -sN -e "SELECT 1") | |
# print message on screen |
This file contains 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
.container { | |
clear: both; | |
float: left; | |
width: 100%; | |
overflow: hidden; | |
} | |
#menu { | |
padding: 0; | |
list-style-type: none; |
This file contains 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
# Alternate CSS classes for even and odd numbers... | |
@items = [1,2,3,4] | |
<table> | |
<% @items.each do |item| %> | |
<tr class="<%= cycle("odd", "even") -%>"> | |
<td>item</td> | |
</tr> | |
<% end %> | |
</table> |
This file contains 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
<h2>#<%= post_counter + 1 %> <%= post.title %></h2> |
This file contains 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
<%= render :partial => @posts, :spacer_template => "post_ruler" %> |
This file contains 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
tar cvf images.tar *.jpg |
This file contains 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
ruby > 1 | |
=> 1 | |
ruby > _ + 1 | |
=> 2 | |
ruby > _ + 1 | |
=> 3 |
This file contains 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
RAILS_ENV=production rake db:migrate |
This file contains 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
=begin | |
Anything between these two tokens | |
is ignored by the Ruby interpreter. | |
=end |
OlderNewer