Skip to content
View create.sql
create table events (
user_id int
date date_time
event text
)
View 4.sql
calculated as (select time_period,
case when lag is null then 'NEW'
when lag_size = 1 then 'ACTIVE'
when lag_size > 1 then 'RETURN'
end as this_month_value,
case when lead_size > 1 then 'CHURN'
else NULL
end as next_month_churn,
View 3.sql
lag_lead_with_diffs as (
select who_identifier, time_period, uses_outlook, lag, lead,
time_period-lag lag_size,
lead-time_period lead_size
from lag_lead),
View 2.sql
lag_lead as (
select who_identifier, time_period,
lag(time_period,1) over (partition by who_identifier order by who_identifier, time_period),
lead(time_period,1) over (partition by who_identifier order by who_identifier, time_period)
from monthly_usage),
View 1.sql
with monthly_usage as (
select
who_identifier,
datediff(month, '1970-01-01', when_timestamp) as time_period
from events
where event = 'login' group by 1,2 order by 1,2),
View basic.sql
select date_trunc('month', date), count(distinct user_id) from events
where event = "login" group by 1 order by 1
View gist:7c7002f217dd12f2b0bc
ruby -e "$(curl -fsSL https://gist.githubusercontent.com/jdwyah/a7432521ea8fa81c1557/raw/9e5b58c28c7965ff94e6aeb1c718c67be62df1f5/homebrew.rb)"
View homebrew.rb
View Gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
ruby '2.0.0'
gem 'rails', '4.0.7'
gem 'pg'
gem 'foreigner'
gem 'devise'
gem 'unicorn'
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
Something went wrong with that request. Please try again.