Skip to content

Instantly share code, notes, and snippets.

<template>
<div>value transformed from 1 -> 2 -> 3 when input focused and button clicked</div>
<input blur.trigger="onBlur() & debounce:100" focus.trigger="onFocus() & debounce:100" />
<button click.delegate="clickHandler()" style="width: 50px">${value}</button>
</template>
@valichek
valichek / NBRBRates.gs
Created February 9, 2017 09:48
Google script to get currency rates from NBRB API.
function NBRBRates(currency, date) {
var formattedDate = Utilities.formatDate(date, Session.getScriptTimeZone(), "yyyy-M-d");
var url = Utilities.formatString("http://www.nbrb.by/API/ExRates/Rates/%s?onDate=%s&ParamMode=2", currency, formattedDate);
var res = UrlFetchApp.fetch(url);
res = JSON.parse(res);
return res.Cur_OfficialRate;
}
// how to use
// =NBRBRates("EUR";TODAY())
@valichek
valichek / gist:bf55a3a7e70e56dd01aeb32abcf3b1e7
Created July 20, 2016 12:17 — forked from excavador/gist:a5a02dadf70573dd4981cab7cc3e3f33
запрос к PostgreSQL, который для указанных табличек сообщит все foreign keys
select
pg_namespace_parent.nspname as parent_schema, pg_class_parent.relname as parent_table, pg_attribute_parent.attname as parent_column,
pg_namespace_child.nspname as child_schema, pg_class_child.relname as child_table, pg_attribute_child.attname as child_column
from
(
select
pg_constraint.conrelid as "parent_table_id",
unnest(pg_constraint.conkey) as "parent_column_id",
pg_constraint.confrelid as "child_table_id",
unnest(pg_constraint.confkey) as "child_column_id"
@valichek
valichek / app.html
Last active June 16, 2016 09:03
Slots and binding context issue
<template>
<require from="./custom"></require>
<custom>
<button click.delegate="doSmth()">First slot</button>
</custom>
<custom>
<!--comment here-->
</custom>
@valichek
valichek / app.html
Last active June 15, 2016 13:14 — forked from jdanyow/app.html
Default slot content is not rendered when content of component is empty issue
<template>
<require from="./custom"></require>
<h2>Example 1: (rendered)</h2>
<custom>
<div slot="first">
<p>First slot</p>
</div>
</custom>
@valichek
valichek / app.html
Last active May 19, 2016 13:34
Aurelia templating issue when using as-element="compose", require and repeat.for with <td>
<template>
<require from="./stringify"></require>
<table>
<tbody>
<tr><td>1 row ${{row: 1} | stringify}</td></tr>
<tr><td>2 row</td></tr>
</tbody>
</table>
@valichek
valichek / app.html
Last active May 19, 2016 13:30
Aurelia templating issue when using as-element="compose", require and repeat.for with <td>
<template>
<require from="./stringify"></require>
<table>
<tbody>
<tr><td>1 row ${{row: 1} | stringify}</td></tr>
<tr><td>2 row</td></tr>
</tbody>
</table>
@valichek
valichek / app.html
Last active May 13, 2016 15:04
Aurelia Value Proxy idea
<template>
<require from="value-proxy"></require>
<value-proxy view-model.ref="personJson" value.bind="stringify(person)"></value-proxy>
${personJson.value}
</template>
@valichek
valichek / app.html
Last active May 14, 2016 10:16
Aurelia + i18n plugin issue with binding behaviour
<template>
<h1>${message}</h1>
<h2>${prop}</h2>
<div>${'val1' & t}</div>
<div>${'val1' & t}</div>
<hr/>
<div>
<!--<compose containerless view.bind="'custom-view.html'"></compose>-->
</div>
<hr/>
<template>
<h1>${message}</h1>
<require from="./object-values-value-converter"></require>
<div repeat.for="value of object | objectValues">
${value}
</div>
</template>