Skip to content

Instantly share code, notes, and snippets.

View DmitryMasley's full-sized avatar

Dmytro Masliei DmitryMasley

View GitHub Profile
type Locale {
localeId: String!
description: String!
}
type LocalePair {
targetLocaleId: String!
sourceLocaleId: String!
}
@DmitryMasley
DmitryMasley / cloudSettings
Last active November 1, 2021 13:07
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-11-01T13:07:05.934Z","extensionVersion":"v3.4.3"}
@DmitryMasley
DmitryMasley / cloudSettings
Last active October 11, 2021 06:24
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-10-11T06:24:39.759Z","extensionVersion":"v3.4.3"}
const index = 1;
((arg) => { arg++ })(index);
console.log(`Index: ${index}`);
const str = "a";
((arg) => { arg.toUpperCase() })(str)
console.log(`String: ${str}`);
const obj = { index: 1, str: "a" };
((arg) => { arg.index++; arg.str.toUpperCase(); })(obj);
const promise = new Promise((resolve) => resolve("John Smith"));
// what is the difference between these versions?
// is there incorrect syntax?
//1
promise
.then((name) => {
return `Hello, ${name}`
})
function(state = {
totalCount: 0,
items: []
}, action = {}) {
switch(action.type) {
case "GET_LIST":
case "ADD_ITEM":
case "REMOVE_ITEM":
case "UPDATE":
default:
const promise1 = new Promise((resolve) => {setTimeout(() => {resolve("success")}, 1000)});
promise1.then((message) => {console.log(`${message} 1`)});
promise1.then(() => {throw "exeption"});
promise1.then((message) => {console.log(`${message} 2`)});
const promise2 = new Promise((resolve) => {setTimeout(() => {resolve("success")}, 2000)});
promise2
.then((message) => {console.log(`${message} 3`)})
.then(() => {throw "exeption"})
.then((message) => {console.log(`${message} 4`)});
import React from “react”;
class MyClass extends React.Component {
constructor(props) {
this.state = {
count: 0,
error: null
}
super(props);
}
function f () {
a = 1;
b = 2;
c = 3;
d = 4;
var a;
let b;
const c;
}
// returns collection with identifer `id`
const getStrings = () => {
return new Promise((resolve) => {
resolve([
{
id: "id",
sourceString: "{1} word"
}
])
});