| command | description |
|---|---|
| ctrl + a | Goto BEGINNING of command 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
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
- Course: https://www.codeschool.com/courses/rails-4-patterns
- Slides: http://courseware.codeschool.com.s3.amazonaws.com/rails4patterns/rails_4_patterns.pdf
- guard clause - http://www.thechrisoshow.com/2009/02/16/using-guard-clauses-in-your-ruby-code/
- scopes always return a chainable object!
In some cases, only these lines will work
for product in IntelliJIdea WebStorm DataGrip PhpStorm CLion PyCharm GoLand RubyMine; do
rm -rf ~/.config/$product*/eval 2> /dev/null
rm -rf ~/.config/JetBrains/$product*/eval 2> /dev/null
doneBut if not, try these
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
| columns_that_make_record_distinct = [:some_id, :another_name] | |
| distinct_ids = Model.select("MIN(id) as id").group(columns_that_make_record_distinct).map(&:id) | |
| duplicate_records = Model.where.not(id: distinct_ids) |
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
| class Array | |
| def self.toy(n=10, &block) | |
| block_given? ? Array.new(n,&block) : Array.new(n) {|i| i+1} | |
| end | |
| end | |
| class Hash | |
| def self.toy(n=10) | |
| Hash[Array.toy(n).zip(Array.toy(n){|c| (96+(c+1)).chr})] | |
| 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
| rubocop -a `git diff --name-only --cached | grep '\.rb'` |
FWIW: I didn't produce the content presented here (the outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.
- By Edmond Lau
- Highly Recommended 👍
- http://www.theeffectiveengineer.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
| #!/usr/bin/env bash | |
| # $ crontab -e | |
| # 0 0 25 * * * ~/bin/rubymine-reset-eval.sh | |
| # Directories | |
| LIB=${HOME}/Library | |
| PREFS=${LIB}/Preferences | |
| CACHE=${LIB}/Caches | |
| ASUPP=${LIB}/Application\ Support |
NewerOlder
