title | subtitle | author | date | source |
---|---|---|---|---|
npm vs Yarn Command Translation Cheat Sheet |
CLI commands comparison |
yarn |
February 15, 2020 |
@FunctionalInterface | |
public interface A<T, R> extends Function<T, R>, Serializable { | |
} |
- General | |
[ ] The code works | |
[ ] The code is easy to understand | |
[ ] Follows coding conventions | |
[ ] Names are simple and if possible short | |
[ ] Names are spelt correctly | |
[ ] Names contain units where applicable | |
[ ] Enums are used instead of int constants where applicable | |
[ ] There are no usages of 'magic numbers' | |
[ ] All variables are in the smallest scope possible |
# first: | |
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done | |
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.* | |
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following: | |
# go to /usr/local/lib and delete any node and node_modules | |
cd /usr/local/lib | |
sudo rm -rf node* |
This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.
I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.
Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.
There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.
So, these are the different settings we are going to compare:
- Go HTTP standalone (as the control group)
- Nginx proxy to Go HTTP
- Nginx fastcgi to Go TCP FastCGI
- Nginx fastcgi to Go Unix Socket FastCGI
CREATE OR REPLACE FUNCTION random_int_array(dim integer, min integer, max integer) RETURNS integer[] AS $BODY$ | |
begin | |
return (select array_agg(round(random() * (max - min)) + min) from generate_series (0, dim)); | |
end | |
$BODY$ LANGUAGE plpgsql; | |
-- usage example | |
select random_int_array(15, 6, 40); | |
-- return example |
Most active GitHub users (git.io/top)
The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.
Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:
githubUsers
.filter(user => user.followers > 1000)
import java.util.HashMap; | |
import java.util.Map; | |
import java.util.Map.Entry; | |
/** | |
* 一种本地缓存的无锁实现思路 | |
* 适用场景:预先知道的需要缓存的一批数据,比如卖家品牌授权,馆信息,达人信息 | |
* 数据更新不太频繁,定时更新或者更新由自己手动控制 | |
*/ | |
public abstract class AbstractLocalCache<K, V> { |