This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//I have the following scenario which I'm not quite sure how to solve. | |
//This function needs to point to the right scope. | |
const useState = (...args) => Lifecycle.useState(...args); | |
//Imagine something like an async react component. It can use a hook useState to obtain a state. | |
const Foo = async (props) => { | |
console.log ("Rendering Foo") | |
const [state] = await useState(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Closed question on Stackoverflow | |
//https://stackoverflow.com/questions/62923537/create-new-object-using-two-objects-that-share-a-prop# | |
users = [ | |
{userId: 1, name: "John", favoriteFruit: "Apple"}, | |
{userId: 2, name: "Jerry", favoriteFruit: "Pear"}, | |
{userId: 3, name: "Linda", favoriteFruit: "Peach"}, | |
{userId: 4, name: "Cruz", favoriteFruit: "Banana"}, | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You can write a simple helper function that accepts an array of fields to sort by. The logic is simple: Iterate over the fields and return -1 if a is less then b or 1 if a is greater then b. If they are equal, do the same comparison for the next field. If all comparisons are equal, return 0. | |
const data = [ | |
{id:1,created:"2020:12:12T10:12:56",start:"2020:12:10"}, | |
{id:1,created:"2020:12:12T10:12:58",start:"2020:12:09"}, | |
{id:1,created:"2020:12:12T10:12:57",start:"2020:12:08"}, | |
{id:1,created:"2020:12:12T10:12:53",start:"2020:12:11"}, | |
{id:1,created:"2020:12:12T10:12:53",start:"2020:12:09"}, | |
{id:1,created:"2020:12:12T10:12:53",start:"2020:12:10"}, | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const foo = { | |
bar: function () { | |
console.log (this); | |
} | |
} | |
const bar = foo.bar; | |
foo.bar(); | |
bar(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function roundDown (ts, duration) { | |
const now = moment(ts); | |
const dur = duration.split (" "); | |
dur [0] = +dur[0]; | |
const rest = (now[dur[1]]() % dur[0]) | |
const start = now.clone().subtract(rest, dur[1]).startOf(dur[1]) | |
return +start; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CALENDAR_VIEW = '//' + location.host + "/api/v2.0/me/calendarview?startDateTime=1970-01-01T00:00:00Z&endDateTime=2111-10-28T13:03:38.168Z&$select=Subject" | |
async function turnPrivate (entry) { | |
let options = { | |
method: 'PATCH', | |
headers: new Headers ({ | |
"Content-Type": "application/json" | |
}), | |
body: JSON.stringify ({ | |
Sensitivity: "2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Und wenn du morgens mal wieder beim zum meditieren spazieren gehen urinierend am Wegrand stehen bleibst und dein Blick über das saftige grün dieser hügligen wiesen streift, dann vergisst du ganz leicht während um dich herum alles im wunderbar warmen goldgelben Ton des Sonnenlichts strahlt, warum: | |
Du eigentlich nichts lieber willst als wieder mit ihr über diesen Wiesen spazieren zu gehen, noch einmal ihr wunderschönes lächeln zu sehen, doch während du, schon langsam wieder am gehen, deine Augen zumachst fängt an die Zeit still zu stehen, wie ein Wirbelwind sich um sich selbst zu drehen und entgegen aller Gesetze sogar der der Natur stellt sich dir irgendwann dein eigenes ich selbst vor | |
wenn du morgens mal wieder beim zum meditieren spazieren gehen urinierend am Wegrand stehen bleibst und dein Blick über das saftige grün dieser hügligen wiesen streift, dann vergisst du ganz leicht während um dich herum alles im wunderbar warmen goldgelben Ton des Sonnenlichts strahlt, warum: | |
deine Gefühle auf einmal nicht |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (window) { | |
var DOUBLE_CLICK_DELAY = 550; | |
var OnlineNotifier = (function () { | |
var LOG_LEVEL = 01; | |
var POLL_TIMEOUT = 1E3; | |
var MIN_TIMEOUT = 60E3; | |
var MIN_TIMEOUT_TYPING = 5E3 | |
var DEBUG_CHECK_ALL = false; | |
var DEBUG_CHECK_ONLINE = false; | |
var DEBUG_CHECK_TYPING = false; |