Skip to content

Instantly share code, notes, and snippets.

View dmitru's full-sized avatar
🎯

Dmitry Borody dmitru

🎯
  • Inkarnate
  • Remote
  • 13:58 (UTC +04:00)
View GitHub Profile
.app-container .title {
font-family: sans-serif;
font-weight: lighter;
}
.theme-light .app-container {
color: #408bbd;
background-color: white;
}
.theme-dark .app-container {
color: #ddd;
@import 'themes.scss';
.app-container {
@include themify($themes) {
color: themed('textColor');
background-color: themed('backgroundColor');
}
.title {
font-family: sans-serif;
<main id="app-root" class="theme-dark">
...
</main>
<main id="app-root">
<div class="app-container">
<h1 class="title">A title</h1>
<button class="button">A button</button>
</div>
</main>
@dmitru
dmitru / scss-theming-1-theme-definition.scss
Last active February 23, 2017 20:12
theming-with-scss
$themes: (
light: (
backgroundColor: #fff,
textColor: #408bbd,
buttonTextColor: #408bbd,
buttonTextTransform: none,
buttonTextHoverColor: #61b0e7,
buttonColor: #fff,
buttonBorder: 2px solid #fff,
),
@dmitru
dmitru / delete_all_orders_at_price.cpp
Last active April 1, 2016 11:56
HFTBattle Blog, article #2
void delete_all_at_price(Dir dir, Price price) {
auto orders_map = trading_book_info.orders().get_orders_by_dir_to_map(dir);
auto it = orders_map.find(price);
if (it == orders_map.end()) {
return;
}
auto& active_orders = it->second;
for (auto& order : active_orders) {
delete_order(order);
}
@dmitru
dmitru / send_inmemory_zipfile_flask.py
Created January 18, 2016 10:44
How to create and file_send() in-memory zipfiles in Flask
memory_file = BytesIO()
with zipfile.ZipFile(memory_file, 'w') as zf:
files = result['files']
for individualFile in files:
data = zipfile.ZipInfo(individualFile['fileName'])
data.date_time = time.localtime(time.time())[:6]
data.compress_type = zipfile.ZIP_DEFLATED
zf.writestr(data, individualFile['fileData'])
memory_file.seek(0)
return send_file(memory_file, attachment_filename='capsule.zip', as_attachment=True)
@dmitru
dmitru / containers.cpp
Created September 26, 2015 21:08
An example showing usage of some std containers in C++11
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
int main()
{
std::vector<int> a = {1, 2, 3, 4, 5};
a.push_back(42);
@dmitru
dmitru / functional.cpp
Created September 26, 2015 21:08
An example showing how to use some functional constructs in C++
#include <iostream>
#include <string>
#include <vector>
int main()
{
// Enter lambda functions..
auto sum = [] (int x, int y) {
std::cout << "Hello, side-effects!" << std::endl;
return x + y;
@dmitru
dmitru / hw.cpp
Last active December 19, 2015 04:49
My learning of concurrent programming in C++11
#include <iostream>
#include <thread>
void hello()
{
std::cout << "HW!" << std::endl;
}
int main()
{