+----+-------------+-------+------+------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------+---------+----------------------------------+---------+---------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+------+------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------+---------+----------------------------------+---------+---------------------------------+
| 1 | SIMPLE | users | ALL | NULL
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
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 |
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"
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
syntax = "proto3"; | |
message Error { | |
string message = 1; | |
int32 error_code = 20; | |
} | |
message Application { | |
string id = 1; | |
string type = 2; |
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
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 } } |
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:
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
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" |
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
apiVersion: v1 | |
data: | |
endpoint_deadline: 5s | |
listen_addr: "0.0.0.0" | |
listen_port: "50051" | |
metadata: | |
name: heimdall | |
namespace: default |
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
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
"os" | |
"strings" | |
"text/tabwriter" | |
) |