Skip to content

Instantly share code, notes, and snippets.

View asiniy's full-sized avatar

Alex Antonov asiniy

View GitHub Profile
void setup() {
pinMode(8, OUTPUT);
pinMode(13, OUTPUT);
}
void loop() {
// Макс вредло
digitalWrite(8, HIGH);
digitalWrite(13, HIGH);
delay(60000);
const currentLanguage = 'ru' // store this in global state (redux, window, localStorage, flux et.c.)
const countries = [
{
ru: 'Россия',
en: 'Russia',
}, {
ru: 'США',
en: 'USA'
},
@asiniy
asiniy / macos.md
Last active February 4, 2020 09:02
Installing MacOS on virtualbox
#<WebhookEvent:0x00007fa76dd600f8
id: 182109,
payload:
"{\"event\":\"survey_completed\",\"event_uuid\":\"b91b40ff-0589-48e6-a72c-f6e27abef652\",\"created_at\":\"2019-07-26T22:20:18Z\",\"payload\":{\"survey\":{\"uuid\":\"aab458b0-9929-4271-9600-0c311685c122\",\"sent_at\":\"2019-07-26T15:48:10Z\",\"opened_at\":null,\"responded_at\":\"2019-07-26T22:20:18Z\",\"customer_feedback\":{\"person_type\":\"Customer\",\"score\":9,\"comments\":\"Work was done well. They showed up on time.\"}},\"location\":{\"uuid\":\"b18a4e5d-71b1-40ab-b7be-8d239d7e3e93\",\"importer_uid\":null,\"name\":\"Handyman Connection of Calgary\"},\"sale\":{\"uuid\":\"ff05b55c-7344-4364-87e4-4e6b069096fd\",\"importer_uid\":\"362e1b5d-38af-e911-811a-000c29b7354e 6701-016157\"},\"customer\":{\"uuid\":\"b7be40ab-8cae-4cd2-b7f7-b90835ab4a4c\",\"importer_uid\":\"c54926f9-2aae-e911-8117-000c295a727c\",\"name\":\"Carol Delong\",\"email\":\"cdelong@telus.net\",\"notes\":{\"customerType\":\"Residential\",\"customerStatus\":\"Customer\"}}}}",
uuid: "b91
@asiniy
asiniy / cloudSettings
Last active March 20, 2021 05:54
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-03-20T05:54:41.642Z","extensionVersion":"v3.4.3"}
@asiniy
asiniy / MyComponent.jsx
Created July 4, 2018 12:36
MyComponentFinal.jsx // Extending JavaScript with ease (beginner level tutorial)
import React from 'react'
import objectFetch from 'object-fetch'
INNER_CIRCLE_TARGETS_COUNT = 10
class MyComponent extends React.Component {
render() {
// A big function with a complex logic
const { collectorGroup } = this.props
@asiniy
asiniy / index.spec.ts
Created July 4, 2018 11:35
index.spec.ts // Extending JavaScript with ease (beginner level tutorial)
// tslint:disable:no-expression-statement
import { test } from 'ava';
import objectFetch from './index';
const object = { a: 'b' };
test('returns key if it exists', t => {
t.is(objectFetch(object, 'a'), 'b');
});
@asiniy
asiniy / index.ts
Created July 4, 2018 11:23
index.js // Extending JavaScript with ease (beginner level tutorial)
// The only significant difference between TS and JavaScript is interface.
// Interface declarates that object passed as `obj` should be an object actually
interface PassedObject {
readonly [key: string]: any;
}
// Same logic as in our ES6 code
const objectFetch = (obj: PassedObject, property: string): any => {
// tslint:disable-next-line:no-if-statement
if (obj.hasOwnProperty(property)) {
@asiniy
asiniy / objectFetch.js
Created July 4, 2018 07:44
objectFetch // Extending JavaScript with ease (beginner level tutorial)
const objectFetch = (object, propertyName) => {
if (object.hasOwnProperty(propertyName)) {
return object[propertyName]
}
throw new ReferenceError(`key not found: ${propertyName}`)
}
const collectorGroup = { target_count: 10 }
@asiniy
asiniy / zealit.js
Last active July 4, 2018 07:40
zealit // Extending JavaScript with ease (beginner level tutorial)
import zealit from 'zealit'
// A reminder - collectorGroup looks like:
// const collectorGroup = { target_count: 10 }
const fetchedObject = zealit(collectorGroup)
fetchedObject.target_count // returns 10
fetchedObject.targets_count // throws a ReferenceError