Skip to content

Instantly share code, notes, and snippets.

package main
import (
"fmt"
"sync"
"time"
)
type Fetcher interface {
// Fetch returns the body of URL and
@kmarenov
kmarenov / gist:0276950deb6886a5e5c402d45aefec3e
Created September 5, 2021 12:16
Exercise: Equivalent Binary Trees
package main
import (
"golang.org/x/tour/tree"
"fmt"
)
// Walk walks the tree t sending all values
// from the tree to the channel ch.
func Walk(t *tree.Tree, ch chan int) {
islands = [
[0, 1, 1, 1, 1],
[0, 1, 1, 0, 1],
[0, 0, 0, 1, 0],
[1, 1, 1, 0, 0],
];
def islands_num(matr):
m = len(matr)
2020-07-08 10:25:48.396 7867-7909/com.hardworkers.development E/GraphResponse: {HttpStatus: 400, errorCode: 100, subErrorCode: 33, errorType: GraphMethodException, errorMessage: Unsupported get request. Object with ID '1639923286166934' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api}
var stdin = process.openStdin();
stdin.addListener("data", function(d) {
var a = d.toString().split(" ");
console.log(parseInt(a[0]) + parseInt(a[1]));
});
function convert(tokens) {
const token = tokens.splice(0, 1)[0];
if (token === 'NOT') {
return `(${token} ${convert(tokens)})`;
}
if (['AND', 'OR'].includes(token)) {
return `(${convert(tokens)} ${token} ${convert(tokens)})`;
}
const reverse = str => {
let rev = '';
for (let i = str.length-1; i >= 0; i--) {
rev += str[i];
}
return rev;
};
SELECT COUNT(t.product_id)
FROM
(SELECT ppc.product_id AS product_id
FROM product__product_category ppc
LEFT JOIN classification__category cc ON ppc.category_id = cc.id
WHERE cc.context = 'brands'
GROUP BY ppc.product_id
HAVING COUNT(ppc.category_id) > 1
) AS t;
SELECT
COUNT(DISTINCT v.id) FILTER (WHERE ce.timestamp >= '2016-11-01' AND ce.timestamp <= '2016-12-01' AND vg.price IS NULL) AS november_2016_null,
COUNT(DISTINCT v.id) FILTER (WHERE ce.timestamp >= '2016-11-01' AND ce.timestamp <= '2016-12-01' AND vg.price < 1000000 AND vg.price IS NOT NULL) AS november_2016_to_1M,
COUNT(DISTINCT v.id) FILTER (WHERE ce.timestamp >= '2016-11-01' AND ce.timestamp <= '2016-12-01' AND vg.price >= 1000000 AND vg.price < 3000000 AND vg.price IS NOT NULL) AS november_2016_from_1M_to_3M,
COUNT(DISTINCT v.id) FILTER (WHERE ce.timestamp >= '2016-11-01' AND ce.timestamp <= '2016-12-01' AND vg.price >= 3000000 AND vg.price < 5000000 AND vg.price IS NOT NULL) AS november_2016_from_3M_to_5M,
COUNT(DISTINCT v.id) FILTER (WHERE ce.timestamp >= '2016-11-01' AND ce.timestamp <= '2016-12-01' AND vg.price >= 5000000 AND vg.price < 8000000 AND vg.price IS NOT NULL) AS november_2016_from_5M_to_8M,
COUNT(DISTINCT v.id) FILTER (WHERE ce.timestamp >= '2016-11-01' AND ce.timestamp <= '20
$(document.body).on('submit', 'form.valuation-request-form', function (event) {
event.preventDefault();
var title = 'Заявка принята';
var message = 'Мы свяжемся с вами в ближайшее время';
var modal = $('#md-after-subscribe');
var form = $(this);
$.ajax({
type: 'POST',