Skip to content

Instantly share code, notes, and snippets.

View squiter's full-sized avatar

Brunno dos Santos squiter

View GitHub Profile
@squiter
squiter / postgres_queries_and_commands.sql
Created July 11, 2016 14:36 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@squiter
squiter / _flash_render.html.erb
Last active June 8, 2018 05:07 — forked from potomak/_flash.html.erb
Little snippet to render flash messages using twitter bootstrap in Rails.
<% [:notice, :error, :alert].each do |level| %>
<% unless flash[level].blank? %>
<div class="alert <%= flash_class(level) %>">
<a class="close" href="#">×</a>
<%= content_tag :p, flash[level] %>
</div>
<% end %>
<% end %>