Skip to content

Instantly share code, notes, and snippets.

View bobbytables's full-sized avatar
🔥
Putting out fires

Robert Ross bobbytables

🔥
Putting out fires
View GitHub Profile
@bobbytables
bobbytables / query.sql
Created December 3, 2012 19:42
Problem query
Here's my query:
SELECT SQL_BUFFER_RESULT SQL_BIG_RESULT users.id, users.email,
COUNT(av.user_id) AS article_views_count,
COUNT(af.id) AS article_favorites_count,
COUNT(lc.user_id) AS link_clicks_count,
COUNT(ai.user_id) AS ad_impressions_count,
COUNT(ac.user_id) AS ad_clicks_count
FROM users
@bobbytables
bobbytables / explain.md
Created December 3, 2012 19:49
Problem query explain
+----+-------------+-------+------+------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------+---------+----------------------------------+---------+---------------------------------+
| id | select_type | table | type | possible_keys                                                                                                                            | key                                           | key_len | ref                              | rows    | Extra                           |
+----+-------------+-------+------+------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------+---------+----------------------------------+---------+---------------------------------+
|  1 | SIMPLE      | users | ALL  | NULL                                            
class BobbyTables
  attr_accessor :tied_shoes

  def tied_shoes?
    !!tied_shoes
  end

  def tie_shoes!
 self.tied_shoes = true
gem "capybara", "~> 2.0.1"
gem "database_cleaner", "~> 0.9.1"

# We're using this version until it gets merged in to support Capybara v2
# https://github.com/jonleighton/poltergeist/pull/208
gem "poltergeist", git: "https://github.com/brutuscat/poltergeist.git"
syntax = "proto3";
message Error {
string message = 1;
int32 error_code = 20;
}
message Application {
string id = 1;
string type = 2;
require 'benchmark'
task :db_bench => :environment do
Benchmark.bm do |b|
b.report { 1.upto(10000) { User.first } }
b.report { 1.upto(10000) { User.select([:email, :default_edition_id]).first } }
b.report { 1.upto(10000) { User.first.created_at } }
b.report { 1.upto(10000) { User.select([:created_at, :default_edition_id]).first.created_at } }
@bobbytables
bobbytables / cli_aliases.md
Created February 26, 2013 08:06
Aliases and Profiles

So an alias in your terminal is a shortcut to a command, or command with arguments.

For example, Brendan has an alias for ll (double L) that does the ls -l command. Which as we showed will display a list of files vertically in your terminal instead the hard-to-read horizontal way.

These are extremely handy for when you see yourself doing the same command over and over, just make an alias!

To do so, we're going to add it to your profile file. This file is run everytime you start a new session in your terminal (so starting terminal, or a new tab).

Open up terminal. Type in:

@bobbytables
bobbytables / brace.yml
Created October 6, 2017 00:18
A sample file of what a brace rule set could look like
version: 1
environment:
- name: LISTEN_ADDRESS
value: "localhost:8080"
usage: "This is the address that the application listens on"
- name: HEALTH_ADDRESS
value: "localhost:8080/healthz"
usage: "This is the endpoint for health checks performed by kubernetes"
- name: DATABASE_URL
value: "postgres://postgres:5432"
@bobbytables
bobbytables / configmap.yaml
Created January 12, 2018 14:08
Example of ConfigMaps and PodSpecs
apiVersion: v1
data:
endpoint_deadline: 5s
listen_addr: "0.0.0.0"
listen_port: "50051"
metadata:
name: heimdall
namespace: default
@bobbytables
bobbytables / main.go
Created April 26, 2018 20:24
A dumb little HTTP server to print headers easily using a tabwriter.
package main
import (
"fmt"
"log"
"net/http"
"os"
"strings"
"text/tabwriter"
)