const alphas = {
a: 101,
b: 2,
c: 3,
d: 5,
e: 7,
f: 11,
g: 13,
h: 17,
This file contains hidden or 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
let cache = new Map(); | |
let pending = new Map(); | |
function fetchTextSync(url) { | |
if (cache.has(url)) { | |
return cache.get(url); | |
} | |
if (pending.has(url)) { | |
throw pending.get(url); | |
} |
This file contains hidden or 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 { x: offsetLeft } = currentTarget.getBoundingClientRect(); | |
const innerWidth = window.innerWidth; | |
const offsetRight = innerWidth - offsetLeft; | |
if (offsetLeft < TOOLTIP_WIDTH / 2) { | |
// if left space is too small | |
// -------- | |
// |s. | | |
// |---- | s = offsetLeft | |
// | | left = -s = - | |
// -------- |
This file contains hidden or 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
when do migrations, if want make Backward Compatibility, you can add the new function above the old one |
This file contains hidden or 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
#!/bin/bash | |
set -e | |
curl -L -O http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country-CSV.zip | |
unzip GeoLite2-Country-CSV.zip | |
rm GeoLite2-Country-CSV.zip |
This file contains hidden or 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
telnet exampledomain.com 25 | |
Trying 1.1.1.1... | |
Connected to exampledomain.com (1.1.1.1). | |
Escape character is '^]'. | |
220-server1.exampledomain.com ESMTP Exim 4.66 #1 Wed, 01 Jua 2020 23:55:12 +0200 | |
220-We do not authorize the use of this system to transport unsolicited, | |
220 and/or bulk e-mail. | |
EHLO exampledomain.com | |
250-server1.exampledomain.com Hello [1.1.1.2] | |
250-SIZE 52428800 |
This file contains hidden or 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
__dirname | |
``` | |
_, filename, _, ok := runtime.Caller(0) | |
if !ok { | |
panic("No caller information") | |
} | |
__dirname := path.Dir(filename) | |
``` |
In your command-line run the following commands:
brew doctor
brew update
The error is
Building native extensions. This could take a while...
ERROR: Error installing libxml-ruby:
ERROR: Failed to build gem native extension.
current directory: /Users/<username>/.rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/libxml-ruby-3.1.0/ext/libxml
/Users/<username>/.rbenv/versions/2.3.7/bin/ruby -r ./siteconf20190523-40908-1mq6z0c.rb extconf.rb
checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no
*** extconf.rb failed ***
This file contains hidden or 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
The idea of *shunting yard algorithm* is to keep operators on a stack until their operands have been parsed. The operands are | |
kept on a second stack. The *shunting yard algorithm* can be used to directly evaluate expressions as they are parsed, to create | |
a reverse Polish notation of an infix expression, or to create an AST. I'll create an AST, so my operand stacks will contain trees | |
The key to the algorithm is to keep the operators on the operator stack odered by precedence(lowest at bottom and highest at the top) | |
at least in the absence of parenthese. Before pushing an operator onto the operator stack, all higher precedence operators are cleard | |
from the stack. Clearing an operator consists of removing the operator from the operator stack and its operands from the operand stack | |
making a new tree, and pushing that tree onto the operand stack. At the end of an expression the remaining operators are put into | |
trees with their operands and that is that. |
NewerOlder