Skip to content

Instantly share code, notes, and snippets.

View gotenxds's full-sized avatar

David limkys gotenxds

  • none
  • Israel
View GitHub Profile
public boolean checkPermissions()
{
// validDate is necessary in order for a permission to be valid.
return prem.validDate == currentDate &&
prem.allowedToFetch(id) &&
prem.type == PremissionType.Admin;
}
funcation someOperation(){
return Promise.all(getDogs(), getCats())
.then([dogs, cats] => makeItRain(cats, dogs))
.then(openAnimalProffUmbrella);
}
async function doStuff(){
try {
const result = await rainSomeCatsAndDogs();
return result();
  } catch(someCatsAndDogs) {
  // do something;
  }
}
async function doStuff(){
try {
  return await rainSomeCatsAndDogs();
  } catch(someCatsAndDogs) {
  // do something;
  }
}
@gotenxds
gotenxds / 3.js
Last active January 19, 2018 21:02
function rainSomeCatsAndDogs(){
  return Promise.all([getDogs(), getCats()])
.then([dogs, cats] => makeItRain(cats, dogs))
  .then(openAnimalProffUmbrella);
}
async function rainSomeCatsAndDogs() {
  const dogs = await getDogs();
  const cats = await getCats();
await makeItRain(cats, dogs);
  await openAnimalProffUmbrella();
}
async function rainSomeCatsAndDogs() {
  const [dogs, cats] = await Promise.all([getDogs(), getCats()]);
 
  await makeItRain(cats, dogs);
  await openAnimalProffUmbrella();
}
async function rainSomeCatsAndDogs() {
  const dogsPromise = getDogs();
  const catsPromise = getCats();
  const [dogs, cats] = [await dogsPromise, await catsPromise];
 
await makeItRain(cats, dogs);
  await openAnimalProffUmbrella();
}
async function rainSomeCatsAndDogs() {
const [dogs, cats] = await Promise.all([getDogs(), getCats()]);
 
await makeItRain(cats, dogs);
await openAnimalProffUmbrella();
}
@gotenxds
gotenxds / x.js
Last active January 19, 2018 21:07
async function doStuff(){
try {
  return rainSomeCatsAndDogs();
} catch(someCatsAndDogs) {
  // do something;
}
}