Skip to content

Instantly share code, notes, and snippets.

@zettamax
zettamax / drunk-text.js
Created October 22, 2017 23:16
Javrscirpt drusnk tetx transloaetr
function drunk(text) {
function modifyWord(word, i, a) {
var wordArray = word.split('');
var isPunct = punct.test(word);
if (!isPunct) {
if (chance(50)) {
var letter = letters[Math.floor(letters.length * rand())];
var position = Math.floor(wordArray.length * rand());
#schema
create table `first` (
`market_id` int unsigned NOT NULL,
`date` datetime NOT NULL,
`value` double NOT NULL
);
#query
select `market_id`, min(`value`) as `min_value`
from `first`
@zettamax
zettamax / boston.ipynb
Created January 31, 2016 20:21
iPython Notebook file - Boston
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zettamax
zettamax / wine.ipynb
Last active January 31, 2016 20:16
iPython Notebook file
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<?php
$cid = $this->data['reader_id'] . '.' . $this->data['reader_id'];
$view->trackingOpensUrl = 'http://www.google-analytics.com/collect?' . http_build_query(
[
'v' => '1',
'cid' => $cid,
'tid' => 'UA-1113296-75',
'uid' => $this->data['reader_id'],
't' => 'event',
@zettamax
zettamax / free_trial_count.sql
Created February 17, 2015 08:49
Free trial pays group by date
select date(date) date_pay, count(*) cs from payments pm where pm.product_id in (select product_id from products pr where status = 'on' and params_provider like '%free_trial%') and log_id != 0 group by date_pay;
@zettamax
zettamax / check_android_free_trial.sql
Created February 17, 2015 03:44
Check free trial payments
select * from payments pm where pm.product_id in (select product_id from products pr where status = 'on' and params_provider like '%free_trial%') and log_id != 0;
select * from readers_items r
join items i on i.item_id = r.item_id
left join songs s on s.song_id = i.song_id
left join authors a on a.author_id = s.author_id
where r.reader_id = %reader_id here%
and (a.author_id is null or s.song_id is null)
@zettamax
zettamax / backtrace_printer.php
Last active August 29, 2015 14:06
Debug helper
<?php
declare(ticks=100);
register_tick_function('do_profile');
function do_profile() {
$bt = debug_backtrace();
if (count($bt) <= 1) {
return;
}
$frame = $bt[1];
unset($bt);

#Деградация функциональности http://joxi.ru/DxXOU4wyTJCzLlQsA7o Есть фичи у проекта - есть критичные вещи, есть такие что можно пожертвовать чем-то При проектировании архитектуры нужно учесть возможные фоллбеки Все доп, фичи можно отключить или не использовать в ситуации крайней нагрузки

#Масштабирование Нагрузка растет нужно мастабироваться