Skip to content

Instantly share code, notes, and snippets.

View mcwqy9's full-sized avatar

Matthew Wheeler mcwqy9

View GitHub Profile

Everything I knew to do here, I learned from this pluralsight course:https://app.pluralsight.com/library/courses/postgresql-playbook/table-of-contents and this blog post: http://www.craigkerstiens.com/2012/10/01/understanding-postgres-performance/

I used cg run -e <env> bash and then psql $DATABASE_URL to connect to the DB

I used the postgres query here to find big tables with low rates of using indexes, see “Understanding Index Usage” : http://www.craigkerstiens.com/2012/10/01/understanding-postgres-performance/

googledrivelti=> SELECT
googledrivelti->   relname,
googledrivelti->   100 * idx_scan / (seq_scan + idx_scan) percent_of_times_index_used,
{
"Records": [
{
"eventVersion": "1.05",
"eventID": "39eccbe6-89dc-44c4-8aa6-6666519151b3",
"eventTime": "2017-01-23T17:01:52Z",
"requestParameters": {
"enabled": false,
"uUID": "e93ddac2-8225-462a-81dc-edf0711b8ad5",
"functionName": "live-events-replicator-beta-lambda"
@mcwqy9
mcwqy9 / cucumber.rb
Created March 11, 2013 20:43
Cucumber failures
Failing Scenarios:
cucumber features/automotive_listings.feature:4 # Scenario: Creating a new automotive listing and correcting validation errors
cucumber features/confirmations.feature:4 # Scenario: User confirms their email
cucumber features/creating_an_account.feature:4 # Scenario: I create a paid account
cucumber features/creating_an_account.feature:14 # Scenario: I create a paid account with a coupon
cucumber features/creating_an_account.feature:25 # Scenario: I create a paid account with a coupon allowing $0 for a minimum deposit
cucumber features/job_listings.feature:7 # Scenario: Creating a new job listing
cucumber features/job_listings.feature:44 # Scenario: Creating a new job listing without application url or company website
cucumber features/my_account.feature:4 # Scenario: Dashboard
cucumber features/plans.feature:7 # Scenario: Local listing signup
@mcwqy9
mcwqy9 / xml.rb
Created December 4, 2012 00:42
customize simple xml
# = XmlSimple
#
# Author:: Maik Schmidt <[email protected]>
# Copyright:: Copyright (c) 2003-2011 Maik Schmidt
# License:: Distributes under the same terms as Ruby.
#
require 'rexml/document'
require 'stringio'
# Easy API to maintain XML (especially configuration files).
@mcwqy9
mcwqy9 / output.rb
Created August 31, 2012 05:11
Quimbee judge migration console debugging
1.9.3p194 :003 > Case.first.holding
Case Load (0.7ms) SELECT "cases".* FROM "cases" LIMIT 1
=> "(Marshall, C.J.) (1) Yes. Marbury does have a right...
1.9.3p194 :004 > Case.first
Case Load (1.7ms) SELECT "cases".* FROM "cases" LIMIT 1
=> #<Case case_id: 706844, member_id: 0, name: "Marbury v. Madison", court_name: "United States Supreme Court", full_citation: "5 U.S. (1 Cranch) 137 (1803)", rule: "The Supreme Court of the United States has the auth...", facts: "William Marbury (plaintiff) was appointed Justice o...", issues: "(1)<b> </b>Does Marbury have the right to his judic...", holding: "(Marshall, C.J.) (1) Yes. Marbury does have a right...", status: 1, date_added: "2012-01-03 01:23:54", viewed_at: "2012-01-03 01:23:54", viewed_times: 504, meta_description: nil, meta_keywords: nil, subject_id: nil, casebook_id: nil, video_id: nil, judge_name: nil>
[In another window]
Matthews-MacBook-Pro:Quimbee Matt$ bundle exec rake db:migrate
== TransitionJudgenameOut: migrating ============================
@mcwqy9
mcwqy9 / shipments.js
Created June 1, 2012 15:35
modified remove template function
function removeTemplate(template, decrement){
if (!decrement){var decrement = false;}
var nextTemplates = template.nextAll('.template');
nextTemplates.find('> legend > span').decrementLegendCount();
nextTemplates.each(function(){
$('label', $(this)).each(function(){
$(this).attr('for', decrementFirstLevelAttributeIterator( $(this).attr('for') ));
});
Wolfpack.Views.LandingPage ||= {}
class Wolfpack.Views.LandingPage.EventsView extends Backbone.View
template: JST["backbone/templates/landing_page/events"]
tagName: "section"
id: "events"
initialize: () ->
@term = ''
window.context = {