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
# create new rails app | |
rails new routes_and_stuff | |
cd routes_and_stuff | |
# generate a user scaffold | |
rails generate scaffold user | |
bundle exec rake db:migrate | |
# checkout routes | |
bundle exec rake routes |
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
-------------------------------------------- | |
-- login as superuser | |
-- use sample_database | |
-- do not allow users to create tables by default | |
REVOKE CREATE ON SCHEMA public FROM public; | |
-- application user | |
CREATE USER tablecreator; | |
ALTER USER tablecreator WITH ENCRYPTED PASSWORD 'password'; |
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
.pagination { padding: 3px; margin: 3px; } | |
.pagination a { padding: 2px 5px 2px 5px; margin: 2px; border: 1px solid #aaaadd; text-decoration: none; color: #000099; } | |
.pagination a:hover, | |
.pagination a:active { border: 1px solid #000099; color: #000; } | |
.pagination span.current { padding: 2px 5px 2px 5px; margin: 2px; border: 1px solid #000099; font-weight: bold; background-color: #000099; color: #FFF; } | |
.pagination span.disabled { padding: 2px 5px 2px 5px; margin: 2px; border: 1px solid #eee; color: #ddd; } | |
/* From http://workingwithrails.com/railsplugin/4765-will-paginate */ |
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
Always start with | |
# get the latest code | |
git checkout master | |
git pull --rebase | |
# ============== | |
Setup to work on new branch / feature | |
You are going to be doing one of two things before adding new changes: |
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
------------ | |
for own key, generator of params | |
------------ | |
http://stackoverflow.com/questions/22001912/prettify-json-output-of-active-model-serializer-in-rails-console?answertab=active#tab-top | |
puts JSON.pretty_generate(FooSerializer.new(p).serializable_hash) |
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
open /Applications/Xcode.app/Contents/Applications/FileMerge.app/ |
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
// https://css-tricks.com/responsive-data-tables/ | |
// https://css-tricks.com/examples/ResponsiveTables/responsive.php | |
// http://elvery.net/demo/responsive-tables/ | |
.no-more-tables-container { | |
@mixin no-more-tables-mixin { | |
// Force table to not be like tables anymore | |
table, thead, tbody, th, td, tr { | |
display: block; | |
} |
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
host SOMEDOMAIN.COM | |
# where ns1.isp.com is one of your ISP DNS servers | |
nslookup SOMEDOMAIN.COM ns1.isp.com | |
dig SOMEDOMAIN.COM @ns1.isp.com | |
traceroute SOMEDOMAIN.COM | |
# on MAC flush dns cache |
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
# given a file with a number on each line | |
# 1) add a comma to the end of each | |
q a # record and store in 'a' | |
A,<esc>j # Go to end of line in insert mode, type , go to next line | |
q # stop recording | |
50@a # run the recording 50 times | |
# 2) put all on a single line | |
:1,50j |
NewerOlder