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
curl https://raw.githubusercontent.com/adcpe/dots/main/.config/fish/functions/redot.fish -o $HOME/.config/fish/functions/redot.fish |
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
def filtered_list(filter_name, filter_value) | |
puts "#{filter_name} - #{filter_value}" | |
query = %(SELECT name, type, city FROM restaurants\n) | |
if filter_name.nil? && filter_value.nil? | |
query << "ORDER BY name ASC;" | |
else | |
query << %(WHERE LOWER(#{filter_name}) LIKE '%#{filter_value}%' ORDER BY name ASC;) | |
end |
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
def initialize | |
@conn = PG.connect(dbname: 'restaurants') | |
end | |
def unique_dishes | |
response = @conn.exec(%(SELECT name FROM dishes ORDER BY name ASC;)).to_a | |
query_to_table(response) | |
end | |
def user_distribution(group_value) |