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
| module Inventory | |
| class Base < ActiveRecord::Base | |
| self.abstract_class = true | |
| self.table_name_prefix = 'inventory.' | |
| end | |
| 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
| -module(parser). | |
| -export([parse/1]). | |
| % Example 1: | |
| % | |
| % Tuple1 = {person, [ | |
| % {name, [{first, "Robert"}, {last, "Sosinski"}]}, | |
| % {home, [{city, "Hoboken"}, {state, "New Jersey"}]}, | |
| % {info, [{age, 30}, {hobbies, [saxophone, beer, french]}]} | |
| % ]}. |
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
| require 'rubygems' | |
| require 'pg' | |
| require 'eventmachine' | |
| module Subscriber | |
| def initialize(pg) | |
| @pg = pg | |
| end | |
| def notify_readable |
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
| with recursive category_ancestors (id, parent_id, name) as ( | |
| select id, parent_id, name | |
| from categories where id = 123 | |
| union | |
| select parent.id, parent.parent_id, parent.name | |
| from categories parent | |
| inner join category_ancestors on parent.id = category_ancestors.parent_id | |
| ) | |
| select * from category_ancestors; |
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
| { | |
| "bold_folder_labels": true, | |
| "color_scheme": "Packages/Color Scheme - Default/Github.tmTheme", | |
| "font_size": 13.0, | |
| "highlight_line": true, | |
| "highlight_modified_tabs": true, | |
| "line_padding_bottom": 1, | |
| "line_padding_top": 1, | |
| "scroll_past_end": true, | |
| "show_full_path": true, |
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
| require 'rubygems' | |
| require 'pg' | |
| require 'eventmachine' | |
| module Subscriber | |
| def initialize(pg) | |
| @pg = pg | |
| end | |
| def notify_readable |
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
| db_config = config.database_configuration[Rails.env] | |
| scheme = db_config['adapter'] | |
| userinfo = [db_config['username'], db_config['password']].compact.join(':') | |
| host = db_config['host'] || 'localhost' | |
| port = db_config['port'] || 5432 | |
| database = db_config['database'] | |
| ENV['QC_DATABASE_URL'] = ENV['DATABASE_URL'] = URI::Generic.new(scheme, userinfo, host, port, nil, "/#{database}", nil, nil, nil).to_s |
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
| select | |
| psut.schemaname, | |
| pc.relname, | |
| pg_size_pretty(pg_relation_size(pc.relname::varchar)) relsize_pret, | |
| pg_size_pretty(pg_total_relation_size(pc.relname::varchar)) total_relsize_pret, | |
| pg_relation_size(pc.relname::varchar) relsize, | |
| pg_total_relation_size(pc.relname::varchar) total_relsize, | |
| pc.reltuples::integer, | |
| pc.relpages, | |
| coalesce(round((8000 / (nullif(pc.reltuples, 0) / nullif(pc.relpages, 0)))), 0) avg_tuplesize, |
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
| module RSpecHelpers | |
| module InstanceMethods | |
| def sign_in(user=nil) | |
| user ||= User.make | |
| fill_in 'user[email]', :with => user.email | |
| fill_in 'user[password]', :with => user.password | |
| click_button 'Sign in' | |
| 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
| #!/bin/bash | |
| filepath="/data/postgresql/9.1/main-backups" | |
| cd $filepath | |
| for database in `ls $filepath/daily`; do | |
| filename=`date +"$filepath/daily/$database/$database-daily-%w-%a.dmp" | tr '[:upper:]' '[:lower:]'` | |
| if [ -e $filename ]; then |