I hereby claim:
- I am me-shaon on github.
- I am ahmed_shamim (https://keybase.io/ahmed_shamim) on keybase.
- I have a public key whose fingerprint is E4BA 494C 935A D262 CED5 8F59 5453 B580 DC74 C2C1
To claim this, I am signing this object:
void testFunction() { //Scope 1: Starts here. This scope is created by the Function block | |
int a = 1; | |
if(true) { //Scope 2: Starts here. This scope created by the 'if' block | |
int b = 2; | |
//a is available here, because it is inside of it's scope | |
printf("%d %d", a, b); | |
}//Scope 2: Ends here | |
function testFunction() { //Scope 1: Starts here. This scope is created by the Function block | |
var a = 1; | |
if(true) { //This block is not creating any new Scope | |
var b = 2; | |
console.log(a, b); //'a', 'b' both is accessible here | |
} | |
console.log(b); //Though 'b' defined inside the 'if' block, it's still accessible here |
function hoist() { | |
a = 10; | |
console.log(a); //this will print '10' | |
var a; | |
} | |
hoist(); |
function hoist() { | |
console.log(a); //this will show 'undefined' | |
var a = 10; | |
} | |
hoist(); |
I hereby claim:
To claim this, I am signing this object:
// রিডাক্স লাইব্রেরীটা থেকে আমরা শুধুমাত্র createSotre মেথডটা import করতেছি | |
import { createStore } from 'redux' | |
// এটাই হচ্ছে আমাদের Reducer ফাংশন যেটা আমরা Redux কে দিবো। | |
// এখানে আমরা বলে দিচ্ছি একটা state আর action দিলে পরবর্তীতে state টা চেঞ্জ | |
// হয়ে কি হবে। এই ফাংশনটা একটা pure function. কেন? কারণ এটাতে যেই | |
// প্যারামিটার গুলো দেয়া হয়, মূলত state টা, সে সরাসরি সেগুলোতে চেঞ্জ করে না, | |
// বরং নতুন একটা পরিবর্তিত ডাটা রিটার্ন করে। এটার কারণেই আসলে লগিং এর কাজটা | |
// ভালোভাবে করা যায়। যেহেতু প্রতিবার নতুন একটা state ডাটা রিটার্ন হয়, logger | |
// টুলস সেটাকে সেইভ করে রেখে দিতে পারে। নতুবা যদি মূল state এ চেইঞ্জ হতো | |
// তাহলে লগারকে আগের state এর রেফারেন্স রাখতে হতো আর লগ দেখানোর সময় |
export default function createStore(reducer) { | |
// আমাদের currentState রাখার জন্য একটা ভ্যারিয়েবল লাগবে | |
let currentState = null; | |
// createStore এ যেই reducer টা পাঠানো হয়েছে সেটার রেফারেন্স | |
// রাখার জন্য একটা ভ্যারিয়েবল লাগবে | |
let mainReducer = reducer; | |
// subscribe মেথডে যেই ফাংশনটা পাঠানো হবে সেটার রেফারেন্স | |
// রাখার জন্য একটা ভ্যারিয়েবল লাগবে | |
let mainListener = null; | |
const addOne = x => (x+1); | |
const addTwo = x => (x+2); | |
const addThree = x => (x+3); | |
const pipe = (...arr) => x => arr.reduce((res, curr) => curr(res), x); | |
console.log(pipe(addOne, addTwo, addThree)(2)); |
https://gist.github.com/kevin-smets/8568070
<?php | |
// Problem 1 | |
function reverse($x) { | |
$x = intval($x); | |
if ($x < 0) { | |
return false; | |
} | |
$reversedInt = 0; |