Skip to content

Instantly share code, notes, and snippets.

View aderyabin's full-sized avatar
👨‍💻
building something new

Andrey Deryabin aderyabin

👨‍💻
building something new
View GitHub Profile
@aderyabin
aderyabin / cohort.sql
Created September 20, 2022 07:56 — forked from bassemawhoob/cohort.sql
Revenue Retention Cohort Analysis - Postgres
-- Based on: https://medium.com/quick-code/how-to-write-sql-to-calculate-user-cohort-retention-a1b3b57c7a2f
-- Uses DATE_PART instead of DATE_DIFF as it is not supported by Postgres
-- (branch_id, scheduled_for, total_cents)
WITH activities AS (
SELECT branch_id, scheduled_for, total_cents
FROM orders
WHERE orders.status = 'complete'
),
-- (branch_id, cohort_month): cohort month is the first order date
@aderyabin
aderyabin / Gemfile
Created July 4, 2020 20:29 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@aderyabin
aderyabin / sketch-never-ending.md
Created July 7, 2017 18:03 — forked from Bhavdip/sketch-never-ending.md
Modify Sketch to never ending trial

###Sketch trial non stop

Open hosts files:

$ open /private/etc/hosts

Edit the file adding:

127.0.0.1 backend.bohemiancoding.com

127.0.0.1 bohemiancoding.sketch.analytics.s3-website-us-east-1.amazonaws.com

@aderyabin
aderyabin / README.md
Last active August 29, 2015 14:18 — forked from mbostock/.block

This histogram shows the distribution of GitHub Gist API response times (in milliseconds) for a sample of 10,000 requests as observed by bl.ocks.org.

The distribution roughly follows a log-normal distribution, which is unsurprising for a complex process that has multiple independently-random sources of delay. The mode response time was in the range 120-140ms, while the median response time was 206ms. The middle 80% of requests were in the range 114-527ms. About 11% of requests took longer than 500ms, and 5% of requests took longer than one second. (The rightmost bin in the histogram includes these long requests.)

Since API endpoints vary dramatically in their computational cost, the distribution of response times is likely multimodal. In this dataset, 96% of requests were for a single gist (/gists/42), while the remaining 4% of requests were to list a user’s gist (/users/fred/gists). By separating the API requests for a single

# I'm running OS X and I need to develop and test Vagrant features
# which are specific to Linux-only, i.e. I need "physical" Linux machine.
# I've finally stuck with creating DigitalOcean VM and installing
# everything necessary for development there. It's magical
# Vagrant-powered Vagrant-development Vagrantfile.
#
# First, start the VM which will be the host:
# $ vagrant up host --provider=digital_ocean
#
# Now, you can start VM in VM which will be used for Vagrant testing:

Введение

Начать стоит отсюда. Не пугайтесь то, что это книга по незнакомой OS, эти термины практически везде одинаковые и здесь они изложены в понятной для начинающих форме.

http://www.qnx.com/developers/docs/6.4.1/neutrino/getting_started/s1_procs.html

Прочесть нужно треть главы до подраздела "Starting a process", если С не пугает, читайте полностью. После прочтения вы будете понимать, что такое process, thread, mutex, priorites, semaphores, scheduler, contex-switch, kernel states.

Ruby

class Merchant < ActiveRecord::Base
# Include default devise modules
devise :database_authenticatable, :registerable, :token_authenticatable, :confirmable,
:recoverable, :rememberable, :trackable, :validatable, :timeoutable, :two_factor_authenticatable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me, :callback_url,
:name, :surname, :phone_number, :address_zip, :address_city, :address,
:balance_btc, :two_factor_authentication
@aderyabin
aderyabin / rack_example.ru
Created January 11, 2012 15:52 — forked from mattetti/rack_example.ru
Very basic rack application showing how to use a router based on the uri and how to process requests based on the HTTP method used.
#########################################
# Very basic rack application showing how to use a router based on the uri
# and how to process requests based on the HTTP method used.
#
# Usage:
# $ rackup rack_example.ru
#
# $ curl -X POST -d 'title=retire&body=I should retire in a nice island' localhost:9292/ideas
# $ curl -X POST -d 'title=ask Satish for a gift&body=Find a way to get Satish to send me a gift' localhost:9292/ideas
# $ curl localhost:9292/ideas