const MY_ARRAY = ['a', 'b', 'c'] as const | |
const objectWithKeysFromConstArrayElements: Record< | |
typeof MY_ARRAY[number], | |
string | |
> = { a: 'foo', b: 'bar', c: 'foobar' } |
var mongoObjectId = function () { | |
var timestamp = (new Date().getTime() / 1000 | 0).toString(16); | |
return timestamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function() { | |
return (Math.random() * 16 | 0).toString(16); | |
}).toLowerCase(); | |
}; |
Morpheus: You have to let it all go, Neo. Fear, doubt, and disbelief. Free your mind.
We live in a world full of distractions - both in our private and professional lives. I'll show you how to keep track of things and focus on what really matters.
Vote for this talk by pushing the ⭐ Star button ↗ on the top right ↗
#![feature(lang_items)] | |
#![no_std] | |
#[no_mangle] | |
pub fn add_one(x: i32) -> i32 { | |
x + 1 | |
} | |
// needed for no_std |
// All webpack chunks have an identifier that is written to both the chunk and | |
// the chunk manifest. | |
// | |
// By default, webpack uses "int" identifiers, where the identifiers are | |
// sequentially generated after chunks are ordered by OccurenceOrderPlugin. | |
// | |
// The result of this is that small code changes may cause chunks to be | |
// reordered, leading to a cascading change of chunk ids, and a large number of | |
// chunk rehashes that could have been avoided. | |
// |
CertSimple just wrote a blog post arguing ES2017's async/await was the best thing to happen with JavaScript. I wholeheartedly agree.
In short, one of the (few?) good things about JavaScript used to be how well it handled asynchronous requests. This was mostly thanks to its Scheme-inherited implementation of functions and closures. That, though, was also one of its worst faults, because it led to the "callback hell", an seemingly unavoidable pattern that made highly asynchronous JS code almost unreadable. Many solutions attempted to solve that, but most failed. Promises almost did it, but failed too. Finally, async/await is here and, combined with Promises, it solves the problem for good. On this post, I'll explain why that is the case and trace a link between promises, async/await, the do-notation and monads.
First, let's illustrate the 3 styles by implementing
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"cloudformation:CreateStack", | |
"cloudformation:UpdateStack", | |
"cloudformation:DescribeStacks", | |
"cloudformation:ListStacks", |
Based on the following guide: https://ericdraken.com/running-xvfb-on-a-shared-host-without-x/
Using the following docker image: https://hub.docker.com/r/lambci/lambda/
def html2markdown(self, html): | |
# convert html to markdown. | |
# specification: | |
# remove all tag exccept tags listed in the cleanbody._repl | |
# when p/div tags are in the table tag, markdown converter (htmlformatter) | |
# confuses. so it is removed | |
# we need following in the header | |
# import re, html2text | |
# from bs4 import BeautifulSoup |