This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open-uri' | |
# Net::HTTP.get(uri) does't work for binary files. File gets corrupted. | |
# | |
# File is opended in binary write mode "wb". The "open" method is provided | |
# by open-uri and is considered unsafe for user input! The "rb" stands for | |
# binary read mode. | |
# | |
# IO.copy_stream does not load the whole file in memory. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################### | |
# | |
# PHP Syntax Check for Git pre-commit hook for Windows PowerShell | |
# | |
# Author: Vojtech Kusy <wojtha@gmail.com> | |
# | |
############################################################################### | |
### INSTRUCTIONS ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Utility functions""" | |
from functools import reduce | |
from operator import getitem | |
from typing import Any, Mapping, Union | |
def getdeep(data: Mapping, map_list: Union[list, str], default: Any = None) -> Any: | |
"""Iterate nested dictionary|list and can return default value if key not found |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/locales/en.yml | |
en: | |
exception: | |
show: | |
not_found: | |
title: "Not Found" | |
description: "The page you were looking for does not exists." | |
internal_server_error: | |
title: "Internal Server Error" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*.c diff=cpp | |
*.h diff=cpp | |
*.c++ diff=cpp | |
*.h++ diff=cpp | |
*.cpp diff=cpp | |
*.hpp diff=cpp | |
*.cc diff=cpp | |
*.hh diff=cpp | |
*.m diff=objc | |
*.mm diff=objc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This module collects various background job retry schedule strategies including the helper functions for the rendering | |
# of the retry table schedule to give better idea in which time frame the jobs are going to be run again. | |
# | |
# Inspired by https://github.com/isaacseymour/activejob-retry and | |
# https://github.com/mperham/sidekiq/wiki/Error-Handling#automatic-job-retry | |
# | |
module JobRetry | |
module_function | |
# Builtin default Sidekiq retry strategy. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Class CaseConverter | |
* | |
* Library for camelCase/StudlyCase/snake_case conversions. | |
*/ | |
class CaseConverter { | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
require 'set' | |
def to_boolean_eq(value) | |
value == true || value == 'true' || value == 1 || value == '1' || value == 't' | |
end | |
def to_boolean_equal(value) | |
value === true || value === 'true' || value === 1 || value === '1' || value === 't' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'net/http' | |
require 'ostruct' | |
require 'optparse' | |
module Fakturuj | |
class Application | |
# https://github.com/honzajavorek/cs-apis/wiki/Kurzy-devizov%C3%A9ho-trhu-%C4%8CNB | |
CNB_DENNI_KURZ_TXT = URI('https://www.cnb.cz/cs/financni_trhy/devizovy_trh/kurzy_devizoveho_trhu/denni_kurz.txt').freeze |
NewerOlder