Skip to content

Instantly share code, notes, and snippets.

View trubachev's full-sized avatar
Нормально делай - нормально будет

Artem Trubachev trubachev

Нормально делай - нормально будет
View GitHub Profile
{
"08:00": {
"shake": [
"2 scoops of casein",
"2 scoops of whey"
],
"supplements": [
"1 pill of Optimen",
"3 pills of Omega 3"
]
const API_TYPE_REGEX = /API_[^_]*$/
const notApiAction = type => !API_TYPE_REGEX.test(type)
const host = "https://www.izettle.com/starwars"
const handleResponse = res => {
if (res.status <= 400 && res.status >= 200) {
return res.json()
}
const day = ([...holes]) => {
const currentHole = holes.indexOf(1);
holes[currentHole] = 0;
if (currentHole === 0) {
holes[1] = 1;
} else if (currentHole === 4) {
holes[3] = 1;
} else {
# App manifest generated Wed Sep 12 2018 21:07:22 GMT+0200 (Central European Summer Time)
# Settings: Facebook,Release,HideConsole
platforms:
x86_64-osx:
context:
excludeLibs: ["engine"]
excludeSymbols: ["FacebookExt"]
libs: ["engine_release"]
linkFlags: []
@trubachev
trubachev / trie.py
Last active March 4, 2020 21:47
This class implements a trie (prefix tree) data structure in Python // Этот класс реализует структуру данных Префиксное древо на Python
class Trie:
class Node:
def __init__(self, char=None):
self.children = []
self.char = char
self.is_leaf = False
def put(self, child_node):
self.children.append(child_node)
@trubachev
trubachev / getDayOfYear
Last active December 25, 2015 00:08
JavaScript function to return number of current day in year work well with leap-years
function getDayOfYear(){
var now = new Date();
var start = new Date(now.getFullYear(), 0, 0);
var diff = now - start;
var oneDay = 1000 * 60 * 60 * 24;
return Math.floor(diff / oneDay);
}