Skip to content

Instantly share code, notes, and snippets.

View bsa7's full-sized avatar

Belevskij Sergeij bsa7

View GitHub Profile
@bsa7
bsa7 / findSimilarItemsInArray.js
Created May 11, 2018 13:02
Найти линейным способом индексы похожих элементов в массиве, не изменяя сам массив
var arr = ["abc", "bac","abc", "d","et","d","et","zzz"];
const unorderedStat = {}
arr.forEach((item, index) => {
const key = item.split('').sort().join()
if (!unorderedStat[key]) {
unorderedStat[key] = [index]
} else {
unorderedStat[key].push(index)
@bsa7
bsa7 / findSimilarItemsInArray.js
Created May 11, 2018 12:46
Найти индексы похожих элементов в массиве
var arr = ["abc", "bac","abc", "d","et","d","et","zzz"];
/**
* Сравнивает две строки на похожесть
* @param {String} sample1
* @param {String} sample2
*/
const compare = (sample1, sample2) => {
return sample1.length == sample2.length && sample1.split('').filter((letter) => sample2.includes(letter)).length > 0
}
@bsa7
bsa7 / courses.js
Last active October 23, 2017 13:00
Организация структуры данных
```javascript
{
name: "Ближневосточные языки",
kind: "group",
type: "Группа курсов",
order: 10,
items: [
{
name: "Татарский",
kind: "group",
@bsa7
bsa7 / elasticsearch.md
Created October 5, 2017 20:15 — forked from nicolashery/elasticsearch.md
Elasticsearch: updating the mappings and settings of an existing index

Elasticsearch: updating the mappings and settings of an existing index

Note: This was written using elasticsearch 0.9.

Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:

$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
  "_id": 1,
<!doctype html>
<html lang="utf-8">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Google Tag Manager -->
<script>
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-KVSBR3');
</script>
<!-- End Google Tag Manager -->
<title data-react-helmet="true">
@bsa7
bsa7 / images.markdown
Created May 22, 2017 15:48
Изображения
object_id_1c WayFile unloadAnnouncement ThisDocument
О00011309 20170310/teh.pasp. eksplikatsiya.jpg 0 0
О00011309 20170310/102.jpg 1 0
О00011309 20170310/103.jpg 1 0
О00011309 20170310/104.jpg 1 0
О00011309 20170310/svidetelstvo.jpg 0 0
О00011309 20170310/107.jpg 1 0
О00011309 20170316/101.jpg 1 0
@bsa7
bsa7 / within_entrance.markdown
Last active April 26, 2017 10:23
Здания новостроек, квартиры которых идут без указания номера подъезда
  {:building_id_1c=>"000000001", :flat_within_entrance=>5},
  {:building_id_1c=>"000000047", :flat_within_entrance=>26},
  {:building_id_1c=>"000000046", :flat_within_entrance=>1},
  {:building_id_1c=>"000000048", :flat_within_entrance=>48},
  {:building_id_1c=>"000000049", :flat_within_entrance=>30},
  {:building_id_1c=>"000000094", :flat_within_entrance=>2},
  {:building_id_1c=>"000000093", :flat_within_entrance=>8},
  {:building_id_1c=>"000000095", :flat_within_entrance=>6},
  {:building_id_1c=>"000000091", :flat_within_entrance=>5},
@bsa7
bsa7 / within_entrance.markdown
Created April 26, 2017 10:23
Здания новостроек, квартиры которых идут без указания номера подъезда
  {:building_id_1c=>"000000001", :flat_within_entrance=>5},
  {:building_id_1c=>"000000047", :flat_within_entrance=>26},
  {:building_id_1c=>"000000046", :flat_within_entrance=>1},
  {:building_id_1c=>"000000048", :flat_within_entrance=>48},
  {:building_id_1c=>"000000049", :flat_within_entrance=>30},
  {:building_id_1c=>"000000094", :flat_within_entrance=>2},
  {:building_id_1c=>"000000093", :flat_within_entrance=>8},
  {:building_id_1c=>"000000095", :flat_within_entrance=>6},
  {:building_id_1c=>"000000091", :flat_within_entrance=>5},
@bsa7
bsa7 / Расхождения.markdown
Last active April 24, 2017 09:07
Расхождения связей по изображениям

Запрос к дампу matrix от 23.04.2017

mysql> SELECT WayFile FROM catalog1c_Realty_ObjectPropertyFile
    -> LEFT JOIN catalog1c_Realty_ObjectProperty
    -> ON catalog1c_Realty_ObjectPropertyFile.MasterFile = catalog1c_Realty_ObjectProperty.id
    -> WHERE catalog1c_Realty_ObjectProperty.id1c = 'О00011555'
    -> ;
+---------------------+
| WayFile             |
+---------------------+