Authorization and Authentication are hard. when you only have to implement them once (as you do within a monolith) instead of over and over again, it makes the developer happy :-), and maybe leads to less implementation failures.
When you have a bunch of microservices, this is something that has to be considered.
Implement it once or in every microservice, or something in between?
This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).
Matrix multiplication is a mathematical operation that defines the product of
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
#include <iostream> | |
#include <vector> | |
using namespace std; | |
void print(const vector<int>& vec) { | |
vector<int>::const_iterator it = vec.begin(); | |
while(it < (vec.end() - 1)) { | |
cout << *it << ','; | |
advance(it, 1); | |
} |
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
<?php | |
/** | |
* What is the difference between new self and new static? | |
* self refers to the same class in which the new keyword is actually written. | |
* | |
* static, in PHP 5.3's late static bindings, | |
* refers to whatever class in the hierarchy you called the method on. | |
* | |
* In the following example, B inherits both methods from A. | |
* The self invocation is bound to A because it's defined in A's implementation |
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
<?php | |
class Singleton | |
{ | |
protected static $instance = null; | |
protected function __construct() | |
{ | |
# Thou shalt not construct that which is unconstructable! | |
} | |
protected function __clone() | |
{ |
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
# VERSION CMake 最低版本需求 | |
cmake_minimum_required (VERSION 3.10) | |
# 项目信息 | |
project (Demo01) | |
# 指定生成目标 | |
add_executable(power main.c) |
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
/** | |
* CustomEvent polyfill | |
* https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill | |
*/ | |
(function () { | |
try { | |
// a : While a window.CustomEvent object exists, it cannot be called as a constructor. | |
// b : There is no window.CustomEvent object | |
new window.CustomEvent('T'); | |
} catch (e) { |
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
function observable (obj, onchange) { | |
return new Proxy(obj, { | |
set (target, key, value) { | |
Reflect.set(target, key, value) | |
onchange(key, value) | |
}, | |
delete (target, key, value) { | |
Reflect.delete(key) | |
onchange(key, undefined) |
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 link = document.createElement('link') | |
link.href = '/css/filename.css' | |
link.type = 'text/css' | |
link.rel = 'stylesheet' | |
link.media = 'screen,print' | |
document.getElementsByTagName( "head" )[0].appendChild( link ) |