Skip to content

Instantly share code, notes, and snippets.

WITH table_scans as (
SELECT relid,
tables.idx_scan + tables.seq_scan as all_scans,
( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes,
pg_relation_size(relid) as table_size
FROM pg_stat_user_tables as tables
),
all_writes as (
SELECT sum(writes) as total_writes
FROM table_scans
@gumayunov
gumayunov / gist:3992138
Created November 1, 2012 06:15 — forked from alinpopa/gist:1281448
elasticsearch analyzer example - Test Queries
# Index
---------------------------------------------------------------------
curl -XPUT http://localhost:9200/pictures/ -d '
{
"settings": {
"analysis": {
"analyzer": {
"index_analyzer": {
"tokenizer": "standard",
@gumayunov
gumayunov / install_jenkins.sh
Created March 29, 2012 15:27 — forked from lox/install_jenkins.sh
A script for installing Jenkins on Ubuntu 10.04
#!/bin/bash
# install the beast
sudo aptitude install openjdk-6-jre git-core
# update rubygems
wget http://production.cf.rubygems.org/rubygems/rubygems-1.7.2.zip
tar xzvf rubygems-1.7.2.tgz
cd rubygems-1.7.2
sudo ruby setup.rb
@gumayunov
gumayunov / vim.rb
Created February 27, 2012 18:37
vim formula for brew
require 'formula'
class Vim <Formula
url 'ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2'
homepage 'http://www.vim.org/'
md5 '5b9510a17074e2b37d8bb38ae09edbf2'
version '7.3.135'
def patchlevel; 135 end
def features; %w(tiny small normal big huge) end
@gumayunov
gumayunov / tpl-basicapp.rb
Created August 5, 2011 03:50 — forked from davidrichards/tpl-basicapp.rb
Rails 3, RSpec, Factory_Girl, HAML, SASS, Devise, JQuery, Backbone.js, jammit
## Rails App Template
## Updated for Rails 3.0.7
## Created on 10/23/10
## Updated on 5/25/11 to simplify for my own use
## Run using $ rails new [appname] -JT -m tpl-basicapp.rb
## Gems
# Warden and Devise for security
gem 'warden', '1.0.4'
$.extend(obj, (function(){
function private_function(){...}
function private_function2(){...}
return {
public_function: function() {...},
public_function2: function() {...}
}
Organizational Principles of CSS and JS in Rails
=== Framework requirements
1. Modularity
2. Complex components are built from simple, atomic components
3. Cross-browser compatibility
a. Follow W3C standards
b. Keep IE hacks in a separate style file
4. Bulletproof
require File.dirname(__FILE__) + '/../spec_helper'
class Foo
def self.per_page
10
end
end
describe Foo do
should_have_per_page 10