Skip to content

Instantly share code, notes, and snippets.

View AaronFlower's full-sized avatar
💭
I may be slow to respond.

AaronFlower

💭
I may be slow to respond.
View GitHub Profile
@AaronFlower
AaronFlower / README.md
Created December 13, 2018 03:13 — forked from omidraha/README.md
Authentication and Authorization Concepts for MicroServices

auth with microservices

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?

@AaronFlower
AaronFlower / Matrix.md
Created September 25, 2018 07:05 — forked from nadavrot/Matrix.md
Efficient matrix multiplication

High-Performance Matrix Multiplication

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).

Intro

Matrix multiplication is a mathematical operation that defines the product of

#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);
}
@AaronFlower
AaronFlower / iterm2-solarized.md
Created March 18, 2018 01:37 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

@AaronFlower
AaronFlower / self-vs-static.php
Last active July 11, 2023 06:10
What is the difference between new self and new static?
<?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
<?php
class Singleton
{
protected static $instance = null;
protected function __construct()
{
# Thou shalt not construct that which is unconstructable!
}
protected function __clone()
{
@AaronFlower
AaronFlower / CMakeLists.txt
Created February 24, 2018 13:28
CMakeLists.txt Simple Demo
# VERSION CMake 最低版本需求
cmake_minimum_required (VERSION 3.10)
# 项目信息
project (Demo01)
# 指定生成目标
add_executable(power main.c)
@AaronFlower
AaronFlower / customEvent.js
Created February 1, 2018 11:05
fix window.CustomEvent
/**
* 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) {
@AaronFlower
AaronFlower / observable.js
Last active February 1, 2018 07:08
A observable function use Proxy and Reflect
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)
@AaronFlower
AaronFlower / load-style-file
Created January 12, 2018 01:16
javascript load css file
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 )