Posts

Showing posts from March, 2019

vim + tmux

https://www.youtube.com/watch?v=5r6yzFEXajQ

Laravel Service Providers, Facades, Contracts

read https://laravel.com/docs/5.8/providers https://laravel.com/docs/5.8/facades https://laravel.com/docs/5.8/contracts

Geospatial Databases and GeoHash

What is https and how to enable https for your website?

What's a good tutorial? "Good" means someone who both understands the subject and more importantly doesn't try to teach everything at once. So let me tell you what the minimum level of SSL understanding that you as a web developer should have, SSL or TLS actually serves a few purposes. but in order to understand why it exists, we must first answer this question. How do you know that the website you've got in your address bar is the actual website you're talking to? How do you KNOW that when you type bilibili.com into a browser, that your computer is actually talking to bilibili? Your browser requests the DNS records for the name, from the name servers you are configured to trust. And IP address comes back, let's say 1.1.1.1. Your browser connected to that IP and sends the header telling the server. you're looking for a host called bilibili.com. and the server gives you the web page you've asked for based on that information. There are several subje

What is docker?

https://www.youtube.com/watch?v=M1j41ud2O-M https://opensource.com/resources/what-docker

What is Immutability?

here is a video that explains the concept Immutability well. https://www.youtube.com/watch?v=qtsbZarFzm8

A classic javascript (closure) interview question

for(var i =0; i<10; i++) {     setTimeout(function(){         console.log(i);     }, i); } //10 10times for(let i =0; i<10; i++) {     setTimeout(function(){         console.log(i);     }, i); } // 0 - 9 for(var i =0; i<10; i++) {     setTimeout((function(j){         console.log(j);     })(i), i); } //0 - 9  because it's an immediately invoked function and this function returns null for(var i =0; i<10; i++) {     setTimeout((function(j){         return function( ) {             // it doesn't need to go out all the way to i to find the variable.              // it stores the value j the moment the outer function gets executed             console.log(j);         }     })(i), i); } //0 - 9

Rate Limiting coding question

Problem: Write a function  validRequest()  that takes no argument .  Return true if gets called 3 times or less in 1 second.

What is Elastic Search and what is it good for?

https://www.youtube.com/watch?v=oPObRc8tHgQ

what is the difference between PUT and PATCH request?

coming soon

What is functional programming?

What is functional programming? a programming paradigm (worldview, mindset) it's kind of a way of looking at a world in terms of what the world is composed of. Imperative follow my commands do this, then that Object-Oriented keep state to yourself send/receive messages Declarative this is what I want I don't care how you do it e.g. SQL Functional sort of a sub-paradigm of Declarative What is functional programming? one simple idea. pure functions (only input in, only output out) Not pure: var name = "Saint Petersburg"; function greet() {     console.log("Hello, " + name + "!"); } greet(); // Hello, Saint Petersburg! Pure: function greet(name) {     return "Hello, " + name + "!"; } greet("Saint Petersburg"); // Hello, Saint Petersburg! Why functional programming? - more predictable, safer - easier to test/debug   all you need to do to test pure functions is to pass in the input and

Bit Manipulation

Image
This post is about Bit Manipulation. I will add more content later. I tend to forget how negative integers are represented in binary a lot. So here is how: base 10     base2(using two's complement)  18             00010010 -18             11101110   0010010 +1101101 +1 ------------------  01111111 +1 Step1: We first flip the digit of positive 18  = 1101101   0010010 +1101110 ------------------ 10000000 Step2: and then add 1 to it. 1101101 + 1  = 1101110 1  1101110 is negative 18, the first 1 is the sign. Masks