http://guides.rubyonrails.org/migrations.html
- add_column
- add_index
- change_column
- change_table
- create_table
- drop_table
| sass-convert -F scss -T sass application_styles.css.scss application_styles.css.sass |
| Git Tips & Tricks | |
| Add your best Git tricks here! | |
| Share the love! | |
| The "I can never remember that alias I set" Trick | |
| [alias] | |
| aliases = !git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /' | sort |
| AES is a block-level algorithm. So when data encrypted it is padded. So you can calculate the length of the result string using this formula: | |
| 1 | |
| 16 × (trunc(string_length / 16) + 1) | |
| So if your address field structure is = VARCHAR(100) ; //100 length of varchar | |
| Then before your encryption it should be converted | |
| = 16 * (trunc(100/ 16) + 1) | |
| = 16 * (6.25 + 1) | |
| = 16 * 7.25 | |
| = 116 |
| git for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))' |
| .cnt-top{ | |
| display: table; | |
| height: 100%; | |
| width: 100%; | |
| text-align: center; | |
| .cnt-middle{ | |
| display: table-cell; | |
| vertical-align: middle; | |
| .cnt-inner{ | |
| margin-left: auto; |
| # rake deploy # Push app to heroku:production, migrate, restarts and tail logs | |
| # rake deploy:production # Push app to production, migrate, restarts, tag and tail logs | |
| # rake deploy:production:config # production config | |
| # rake deploy:production:console # production console | |
| # rake deploy:production:logs # production logs | |
| # rake deploy:production:ps # production ps | |
| # rake deploy:production:releases # production releases | |
| # rake deploy:staging # Push app to staging, migrate, restarts, tag and tail logs | |
| # rake deploy:staging:config # staging config | |
| # rake deploy:staging:console # staging console |
http://guides.rubyonrails.org/migrations.html
| stub_request(:get, /some_host:9999/).with(headers: {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).to_return(status: 200, body: "stubbed response", headers: {}) |
| def trancate | |
| conn = ActiveRecord::Base.connection | |
| tables = conn.execute("SELECT * FROM pg_catalog.pg_tables WHERE schemaname != 'pg_catalog' AND schemaname != 'information_schema' AND tablename != 'schema_migrations'").map { |r| | |
| r['tablename'] | |
| } | |
| p 'Trancate '+tables.join(',').to_s | |
| tables.each { |t| | |
| conn.execute("TRUNCATE #{t}") | |
| } | |
| end |
| def anagram(input) | |
| lookaheadPart = '' | |
| matchingPart = '^' | |
| positiveLookaheadPrefix='(?=' | |
| positiveLookaheadSuffix=')' | |
| letters = input.to_s.split('') | |
| inputCharacterFrequencyMap = letters.reduce(Hash.new(0)) { |a, b| a[b] += 1; a } | |
| inputCharacterFrequencyMap.each do |letter, freq| | |
| lookaheadPart += positiveLookaheadPrefix; |