Skip to content

Instantly share code, notes, and snippets.

@amiskov
amiskov / emojis_to_elm_chars.py
Created June 2, 2020 20:17
Convert list of emojis to unicode escape symobls in Elm Char format.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
emojis = "😄😘😺🚀🚗🚙🚚🌀🌟🌴🌵🌷🌸🌹🌺🌻🌼🌽🌿🍁🍄🍅🍆🍇🍈🍉🍊🍌🍍🍎🍏🍑🍒🍓🍭🍯🎀🎃🎈🎨🎲🎸🏡🐌🐒🐚🐞🐬🐱🐲🐳🐴🐵🐶🐸🐹💜😎🚘🌳🍋🍐"
for e in emojis:
print(f'\\u{{{ord(e):X}}}')
@amiskov
amiskov / idio.py
Created October 24, 2019 07:56
Show today's Idioteka pucture.
import re
import webbrowser
import datetime
import urllib.request
today = datetime.date.today()
date_uri = f"{today.year}/{today.month}/{today.day}"
page_url = 'https://www.artlebedev.ru/kovodstvo/idioteka/' + date_uri
pic_re = r'https:\/\/img\.artlebedev\.ru\/kovodstvo\/idioteka\/i\/[A-Z0-9-]*.jpg'
@amiskov
amiskov / lambda-not-anon.md
Created March 19, 2018 03:46
The distinction between anonymous functions and lambdas in JavaScript.

TL;DR - Lambda means "function used as data".

Anonymous function means "function without a name".

This is one of the relatively few cases where the Wikipedia definition of a word, while not entirely wrong, is misleading. Lambdas and anonymous functions are distinct ideas.

These ideas are commonly confused because in many programming languages (and lambda calculus) all lambdas are anonymous or vise verse.

In JavaScript, not all lambdas are anonymous, and not all anonymous functions are lambdas, so the distinction has some practical meaning.

@amiskov
amiskov / cms-list_right.less
Last active February 1, 2016 08:49
BEM block right
/* HTML-код:
<ul class="cms-list cms-list_square">
<li class="cms-list__item">List Item 1 text</li>
<li class="cms-list__item">List Item 2 text</li>
</ul>
*/
.cms-list {
padding: 0 0 0 7rem;
@amiskov
amiskov / cms-list_wrong.less
Last active February 1, 2016 08:47
BEM list wrong
/* HTML-код:
<ul class="cms-list">
<li class="cms-list__item cms-list__item_square">List Item 1 text</li>
<li class="cms-list__item cms-list__item_square">List Item 2 text</li>
</ul>
*/
.cms {
&-list {
padding: 0 0 0 7rem;
var ajax = {
success: function (data) {
if (!data) {
alert('Ошибка, сервера.');
return;
}
if (data.status == 'success') {
var shippingMethods = 'shipping_methods',
var item = $('.form_search__result .selected a');
if(item.size() == 0) return false;
window.location.href = item.attr('href');
return false;
}
@amiskov
amiskov / test
Created February 27, 2010 06:38
test