curl -v -H 'Content-Type: multipart/form-data' -H 'Accept: application/json' -H 'authorization: Token 1234' -F 'documents=@./upload.txt' -F "description=bla bla" http://0.0.0.0:8080/api/v1/upload
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
sudo vi /etc/default/locale | |
LANGUAGE="ru_RU.UTF-8" | |
LC_ALL="ru_RU.UTF-8" | |
LANG="ru_RU.UTF-8" | |
LC_TYPE="ru_RU.UTF-8" | |
locale-gen ru_RU.UTF-8 | |
dpkg-reconfigure locales |
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
# See http://jordan.broughs.net/archives/2012/07/enumerablecount_by-for-ruby | |
# Ruby >= 1.8.7 (incl 1.9.x) | |
module Enumerable | |
def count_by(&block) | |
Hash[group_by(&block).map { |key,vals| [key, vals.size] }] | |
end | |
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
# Method alias | |
# ------------ | |
macro alias_method(new_name, existing_method) | |
def {{new_name.id}}(*args) | |
{{existing_method.id}}(*args) | |
end | |
end | |
# Generate Union type from array of classes |
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
class Record < ApplicationRecord | |
TracePoint.trace(:call) do |tp| | |
pp [tp.method_id, tp.lineno, tp.path] | |
end | |
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
// Complex configuration object | |
var myObject = { | |
property1: { id: 1, name: 'value property1', handler: data => data.length }, | |
get property2(){ return { ...this.property1, id: 2 } } // ref1 | |
}; | |
// > myObject.property2 | |
// > {id: 2, name: "value property1", handler: f} | |
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
overview.props.$chart.getModel().getSeriesByName('uniqUsers')[0].getData().getVisual('color') | |
// Adaptive labels | |
// https://github.com/apache/incubator-echarts/issues/8841#issuecomment-516034572 | |
echarts.registerLayout(ecModel => { | |
ecModel.eachSeries(seriesComponent => { | |
const data = seriesComponent.getData(); | |
data.each(idx => { | |
const layout = data.getItemLayout(idx); |
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
<div class='container'> | |
<div class='header'>1 — 25 февраля</div> | |
<div id='totalUsers' class='item'> | |
<div class='marker' style='background:#d2dbff'></div> | |
<div class='name'>Общая аудитория:</div> | |
<div class='value'>1,934</div> | |
</div> | |
<div id='uniqUsers' class='item'> | |
<div class='marker' style='background:#d8b2b9'></div> | |
<div class='desc'>Уникальные пользователи:</div> |
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
// https://stackoverflow.com/a/26976623/1597964 | |
function randomSumArray(len, sum, d) { | |
var _sum = 0; | |
var arr = []; | |
var n, i; | |
if (!d && d !== 0) { | |
d = 100; | |
} |
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
[ | |
{ "category": "A", "value": 1 }, | |
{ "category": "B", "value": 2 }, | |
{ "category": "C", "value": 3 }, | |
{ "category": "D", "value": 7 } | |
] |
OlderNewer