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
| [alias] | |
| co = checkout | |
| cob = checkout -b | |
| coo = !git fetch && git checkout | |
| br = branch | |
| brd = branch -d | |
| brD = branch -D | |
| merged = branch --merged | |
| dmerged = "git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d" | |
| st = status |
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
| forum_ids = [1,2,3] # given forum ids | |
| forum_ids.map do |forum_id| | |
| Post.joins(:topic).where(topics: { forum: forum_id }).pluck(:subject, 'posts.*').last | |
| 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
| max_asterisks_in_row = 15 | |
| number_of_asterisk = 1.step(max_asterisks_in_row, 2) # arithmetic progression with step of 2 | |
| number_of_asterisk.each do |asterisk| | |
| spaces = " " * ((max_asterisks_in_row - asterisk) / 2) # spaces before and after asterisk | |
| asterisks = "*" * asterisk # number of asterisk | |
| puts spaces + asterisks + spaces | |
| 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
| heroku login | |
| heroku create app_name | |
| heroku buildpacks:set heroku/ruby |
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
| 1. Generate a CSR and Private key: `openssl req -newkey rsa:2048 -nodes -keyout example.com.key -out example.com.csr` | |
| 2. Enter Common Name with your domain name: example.com | |
| 3. cat example.com.csr | |
| 4. Copy it to your CA (comodo) | |
| 5. Get SSL certificates from the CA (Comodo in my case): | |
| It has 4 certificates in it: AddTrustExternalCARoot.crt / | |
| COMODORSAAddTrustCA.crt / | |
| COMODORSADomainValidationSecureServerCA.crt / | |
| your_domain_name.crt | |
| 6. Make copy of AddTrustExternalCARoot.crt and rename it to: intermediate.crt |
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
| gemfile: | |
| - Gemfile | |
| - components/app_component/Gemfile | |
| script: | |
| - travis_retry ./test.sh | |
| before_install: | |
| - cd $(dirname $BUNDLE_GEMFILE) | |
| rvm: | |
| - 2.3.1 |
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
| ########################################################################################### | |
| Redis: | |
| wget http://download.redis.io/redis-stable.tar.gz | |
| tar xvzf redis-stable.tar.gz | |
| rm redis-stable.tar.gz | |
| cd redis-stable | |
| make | |
| sudo cp src/redis-server /usr/local/bin/ | |
| sudo cp src/redis-cli /usr/local/bin/ | |
| cd |
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
| I am the owner of lvh.me. And I'm glad to hear it's helpful. In truth, it's just a fancy DNS trick. lhv.me and all of it's sub-domains just point back to your computer (127.0.0.1). That means running ssl is as simple (or difficult) as running ssl on your computer. | |
| I'm not sure how comfortable you are with the command line, but here's my how I setup my development environment. (rvm, passenger, nginx w/ SSL, etc). | |
| # Install rvm (no sudo!) | |
| # ------------------------------------------------------ | |
| bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head ) | |
| source ~/.rvm/scripts/rvm | |
| rvm install ree-1.8.7-2010.02 |
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
| rails new app | |
| cd app | |
| rm -r app | |
| mkdir components | |
| rails plugin new components/app_component --full --mountable | |
| cd components/app_component | |
| rails g controller welcome index | |
| fix app.component.gemspec | |
| nano /components/app_component/config/routes.rb | |
| add there: «root to: "welcome#index» |
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
| # | |
| # Sidekiq auto start using systemd unit file for Ubuntu 16.04 | |
| # | |
| # Put this in /lib/systemd/system (Ubuntu). | |
| # Run: | |
| # 1. systemctl enable sidekiq (to enable sidekiq service) | |
| # 2. systemctl {start,stop,restart} sidekiq (to start sidekiq service) | |
| # | |
| # This file corresponds to a single Sidekiq process. Add multiple copies | |
| # to run multiple processes (sidekiq-1, sidekiq-2, etc). |
NewerOlder