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
class DatabaseReport | |
def entry_counts | |
table_model_names.map do |model_name| | |
entity = model_name.constantize rescue nil | |
next if entity.nil? | |
{ entity.to_s => entity.count } | |
end.compact | |
end | |
private |
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
### Keybase proof | |
I hereby claim: | |
* I am brenodamata on github. | |
* I am bren0 (https://keybase.io/bren0) on keybase. | |
* I have a public key ASDNGqNT5KBg5gMaG93pI7yh6Sy0S48eH82b1ctbL7XFPwo | |
To claim this, I am signing this object: |
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
require 'rubygems' | |
require 'faker' | |
def generate_routing_number | |
number = Faker::Number.number(8).to_s | |
d = number.split('').map(&:to_i).select { |d| (0..9).include?(d) } | |
checksum = (3 * (d[0] + d[3] + d[6])) + (7 * (d[1] + d[4] + d[7])) + (d[2] + d[5]) | |
if checksum%10 == 0 | |
d << 0 | |
else |
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
Assuming you're looking to kill whatever is on port 3000, type this in your terminal to find out the PID of the process: | |
$ lsof -wni tcp:3000 | |
Then, use the number in the PID column to kill the process: | |
$ kill -9 PID |
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
require 'rubygems' | |
require 'faker' | |
def generate_routing_number | |
valid = false | |
until valid | |
number = Faker::Number.number(9).to_s | |
valid = valid_routing_number? number | |
end | |
number |