Skip to content

Instantly share code, notes, and snippets.

View getjump's full-sized avatar

Pavel Savinov getjump

View GitHub Profile
@getjump
getjump / lel.md
Last active November 16, 2019 10:52

Serialization: ?

Special Data Types:

  • Error { int code; string message }
  • ApiResponse { T object; Error? error; }
  • GeoPoint { double lat, long; }
  • Token { string token; }
  • FailableAction { bool sucess; }
BASE_URL = 'http://our_app/api/'
string getRequestURL(string apiMethod)
{
return BASE_URL + apiMethod;
}
T request<T>(string apiMethod = 'lockbox/list', enum {GET, POST, PUT, ...} httpMethod, Object params[])
{
string rawData = http.request(self.getRequestURL(apiMethod), httpMethod.toString(), http.buildQuery(params))
@getjump
getjump / gems
Last active December 13, 2015 09:38
https://rubygems.org/gems/devise - authentication
https://rubygems.org/gems/pundit - rbac
https://github.com/ryanb/cancan - rbac
https://rubygems.org/gems/draper - decorator for models
https://rubygems.org/gems/cells - cells
https://rubygems.org/gems/friendly_id - url friendly
https://github.com/rsl/stringex - prettyurl
https://rubygems.org/gems/simple_form - forms
https://rubygems.org/gems/paperclip - files stuff
https://rubygems.org/gems/kaminari - pagination
@getjump
getjump / test.yaml
Last active November 16, 2019 10:53
controllers:
desc: Все возможные контроллеры в системе
id: primary key
name: Название контроллера(системное!)
actions:
desc: Все возможные действия в системе(с возможностью использования wildcard символа)
id: primary key
name: Название действия(системное!)
controller_id: foreign key controllers.id - контроллер
@getjump
getjump / Dockerfile
Last active July 12, 2019 09:27
Docker + Rails + Unicorn + Nginx + Gulp + PostgreSQL
FROM ruby:2.2.0
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev
RUN mkdir /myapp
RUN mkdir /tmp/sockets
WORKDIR /myapp
ADD Gemfile /myapp/Gemfile
@getjump
getjump / test.html
Created April 21, 2016 12:27
Thoughts area
<h2 id="r-tree">R*-tree</h2>
<p><a href="http://www.cs.ucr.edu/~tsotras/cs236/W15/rstar.pdf">Source article about R*-tree</a></p>
<h3 id="what-is-r-tree-actually">What is r-tree actually</h3>
<ul>
<li><script type="math/tex" id="MathJax-Element-1"> B^+ </script> tree like structure, which stores multidimensistrong textonal rectangles</li>
Panagea Protocol Client/Server
Протокол будет составлен из минимальных частей, которые будут наращиваться с каждой версией, слоёв.
0 слой - базовая единица для поддержания подключения между клиентом/сервером.
Подключение через классическое TCP Keep-Alive соединение.
Сериализация будет иметь следующий вид:
<?php
$fcount = count(glob('webms/*.webm'));
$watched = [];
if(isset($_COOKIE['watched']))
{
$watched = json_decode($_COOKIE['watched']);
}

Serialization: ?

Special Data Types:

  • Error { int code; string message }
  • ApiResponse { T object; Error? error; }
  • GeoPoint { double lat, long; }
  • Token { string token; }
  • FailableAction { bool sucess; }
<?php namespace getjump\CarPad\Drom;
// https://api.drom.ru/v1.2/bulls/search?app_id=p8&cid%5B0%5D=23&mainPhotoWidth=300&page=1&pretty=1&revertSort=1&sortBy=enterdate&sticky_region%5B0%5D=25&timestamp=1495761446&secret=53e7ac1a6b6b42f0728657a515d6992f09a5a227c5799987941ab30eaecb0513
class BasicQuery
{
const API_URL = '{protocol}://api.drom.ru/v{version}/{method}';
private $appId;
private $key;
private $version;