| name | explain-diff-html |
|---|---|
| description | Use when the user asks for a rich explanation of a code change, diff, branch, or PR. Produces HTML output. |
Please make me a rich, interactive explanation of the specified code change.
It should have these sections:
| // XPath CheatSheet | |
| // To test XPath in your Chrome Debugger: $x('/html/body') | |
| // http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/ | |
| // 0. XPath Examples. | |
| // More: http://xpath.alephzarro.com/content/cheatsheet.html | |
| '//hr[@class="edge" and position()=1]' // every first hr of 'edge' class |
| /* eslint-disable no-console, camelcase */ | |
| const server = require('http').createServer().listen(0); | |
| const { Issuer, generators } = require('openid-client'); | |
| const open = require('open'); | |
| server.removeAllListeners('request'); | |
| const { ISSUER = 'https://op.panva.cz' } = process.env; |
There was a [great article][1] about how react implements it's virtual DOM. There are some really interesting ideas in there but they are deeply buried in the implementation of the React framework.
However, it's possible to implement just the virtual DOM and diff algorithm on it's own as a set of independent modules.
| |----------------------------------------------------------------------------------------|--------------------| | |
| | Object Header (64 bits) | State | | |
| |-------------------------------------------------------|--------------------------------|--------------------| | |
| | Mark Word (32 bits) | Klass Word (32 bits) | | | |
| |-------------------------------------------------------|--------------------------------|--------------------| | |
| | identity_hashcode:25 | age:4 | biased_lock:1 | lock:2 | OOP to metadata object | Normal | | |
| |-------------------------------------------------------|--------------------------------|--------------------| | |
| | thread:23 | epoch:2 | age:4 | biased_lock:1 | lock:2 | OOP to metadata object | Biased | | |
| |-------------------------------------------------------|--------------------------------|--------------------| | |
| | |
| 'use strict'; | |
| const crypto = require('crypto'); | |
| const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bytes (32 characters) | |
| const IV_LENGTH = 16; // For AES, this is always 16 | |
| function encrypt(text) { | |
| let iv = crypto.randomBytes(IV_LENGTH); | |
| let cipher = crypto.createCipheriv('aes-256-cbc', new Buffer(ENCRYPTION_KEY), iv); |
The early programmer struggles with the Javascript keyword this. But understanding your this context is easier than it seems.
This is all about where a function is invoked.
Often, early programmers worry about where the function was declared. Perhaps the function was declared in a specific file or a particular object. Surely this changes it's this!
Nope.
To understand this, we need to see where it is invoked. Nothing else matters, with one exception which we'll cover in a moment.
| package object mail { | |
| implicit def stringToSeq(single: String): Seq[String] = Seq(single) | |
| implicit def liftToOption[T](t: T): Option[T] = Some(t) | |
| sealed abstract class MailType | |
| case object Plain extends MailType | |
| case object Rich extends MailType | |
| case object MultiPart extends MailType |
| /** Your task is to reason your way to which compiler | |
| * options which will be passed for each of | |
| * 1) sbt root/compile | |
| * 2) sbt p1/compile | |
| */ | |
| scalacOptions := Seq("-DSBT") | |
| scalacOptions in ThisBuild += "-D0" | |
| scalacOptions in Global += "-D1" |
| import java.io.IOException; | |
| import java.nio.charset.StandardCharsets; | |
| import java.nio.file.Files; | |
| import java.util.Arrays; | |
| import java.util.Iterator; | |
| import java.util.Properties; | |
| import org.I0Itec.zkclient.ZkClient; | |
| import org.apache.kafka.clients.consumer.ConsumerRecord; | |
| import org.apache.kafka.clients.consumer.ConsumerRecords; | |
| import org.apache.kafka.clients.consumer.KafkaConsumer; |