970-290-6669
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
| package controllers | |
| import play.api._ | |
| import play.api.mvc._ | |
| import org.squeryl.PrimitiveTypeMode._ | |
| import models.{Database, FrontPageUpdate} | |
| import com.codahale.jerkson.Json | |
| object Application extends Controller { | |
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
| # Give it two procs to compare | |
| def bm(o, n) | |
| reload! | |
| puts "Running 10 times" | |
| Benchmark.bmbm(10) do |x| | |
| x.report('Old Query:') { @olr = o.call } | |
| x.report('New Query:') { @nr = n.call } | |
| end | |
| reload! |
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
| # Scenario: | |
| # We run a youtube production company and we make videos for paying members. | |
| # Paying members can likewise access paid for premium content, and guests can access free content. | |
| # Pretty straight forward. | |
| # | |
| # Next Scenario: | |
| # We decide, one day, to open source all of our content. All videos, text posts, tutorials, etc | |
| # are now available to *all* users. | |
| # | |
| # What's the most optimal way to be able to ship such a feature, with all tests passing. |
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 table_stats as ( | |
| select psut.relname, | |
| psut.n_live_tup, | |
| 1.0 * psut.idx_scan / greatest(1, psut.seq_scan + psut.idx_scan) as index_use_ratio | |
| from pg_stat_user_tables psut | |
| order by psut.n_live_tup desc | |
| ), | |
| table_io as ( | |
| select psiut.relname, | |
| sum(psiut.heap_blks_read) as table_page_read, |
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
| #!/usr/bin/env python | |
| # encoding: utf-8 | |
| import tweepy #https://github.com/tweepy/tweepy | |
| import csv | |
| import sys | |
| #Twitter API credentials | |
| consumer_key = "" | |
| consumer_secret = "" |
OlderNewer