Skip to content

Instantly share code, notes, and snippets.

View inoyakaigor's full-sized avatar
😎
😎

Igor «InoY» Zviagintsev inoyakaigor

😎
😎
View GitHub Profile
@inoyakaigor
inoyakaigor / ExportJSON.js
Created October 6, 2023 13:29
Export of Google docs table data into JSON
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
@inoyakaigor
inoyakaigor / snippet.sql
Created October 4, 2023 10:21
MySQL/MariaDB import from CSV with multiple SET
LOAD DATA LOW_PRIORITY LOCAL INFILE 'C:\\Users\\InoY\\DOWNLO~1\\927D~1.CSV'
REPLACE INTO TABLE `pomoyka`.`jira_tasks`
CHARACTER SET utf8mb4 FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1
LINES (`key`, `resume`, @created, @updated, `status_from`, `status_to`, @status_date)
SET `created` = STR_TO_DATE(@created, '%d.%m.%Y %H:%i:%s'),
`updated` = STR_TO_DATE(@updated, '%d.%m.%Y %H:%i:%s'),
`status_date` = STR_TO_DATE(@status_date, '%d.%m.%Y %H:%i:%s')
;
const puppeteer = require('puppeteer')
const { PendingXHR } = require('pending-xhr-puppeteer')
;( async () => {
const browser = await puppeteer.launch({
headless: true,
product: 'firefox',
// args,
})
@inoyakaigor
inoyakaigor / xor.ts
Created December 13, 2019 15:36
Typescript XOR type error
type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };
// this type is NOT work as expected
type XOR<T, U> = (T | U) extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
// this type is work as expected
type XOR<T, U> = (T | U) extends Object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
interface IValueWillChange<T> {
object: any;
type: "update";
@inoyakaigor
inoyakaigor / getRanges.js
Created October 8, 2019 13:47
Get range function
const getRanges = arr =>
arr
.reduceRight(
(prev, curr) => (
prev.length
? (
prev[0][0] === curr + 1
? prev[0].unshift(curr)
: prev.unshift([curr])
) && prev
@inoyakaigor
inoyakaigor / VK dark mode.css
Last active July 16, 2020 14:10
VK dark theme
body {
background: #282B2F;
color: #E0E0E0
}
a {
color: #F8F8F8
}
*::selection {
@inoyakaigor
inoyakaigor / React createclass to component.json
Last active April 8, 2019 13:27
React createClass to Component regexp's config for my replacer service https://inoyakaigor.ru/replacer/ add it in localStorage under 'replacers' name
[
{
"active": true,
"from": "(\\n\\s+)([_a-zA-Z]+)(\\: function\\s?)",
"to": "$1$2",
"mods": "gim"
},
{
"active": true,
"from": "(\\n\\s+)([_a-zA-Z]+)\\(([a-z_\\{\\}\\=\\[\\]\\s\\,]+)?\\) {",
@inoyakaigor
inoyakaigor / stylish.css
Last active December 25, 2019 10:43
Dark theme for Habr.com with stylish
.h-info li,.h-info p {
color: #cbcbcb;
}
.h-info a {
color: #558fab;
}
.h-info abbr {
border-bottom: 1px dotted #cbcbcb;
@inoyakaigor
inoyakaigor / Monokai(SL)-ESNext-inoy.tmTheme
Created December 24, 2018 18:37
Подправленная мной тема Monokai с поддержкой ESNext
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Monokai</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
@inoyakaigor
inoyakaigor / index.js
Created November 30, 2018 15:50
Пример синхронизации двух полей с помощью React Context
import React from "react";
import ReactDOM from "react-dom";
const UserContext = React.createContext();
const Donor = () => (
<UserContext.Consumer>
{
store => {
const { value, onChange } = store