Skip to content

Instantly share code, notes, and snippets.

View novonimo's full-sized avatar
🏠
Working from home

Nima Mohamadian novonimo

🏠
Working from home
View GitHub Profile
@novonimo
novonimo / consoleCoolFeature.js
Created September 13, 2019 12:30
use some cool features of console in dev tool
console.log("%c Hello my name is nima", "color: orange; font-weight: bold;");
const foo = {name: "nima", age: 30};
const bar = {name: "sina", age: 28};
const baz = {name: "ahmad", age: 58};
console.table([foo, bar, baz])
console.time("looper")
@novonimo
novonimo / memoization.js
Created September 15, 2019 19:04
create a simple and fast memoization function for calculation.
/*
use this memoiziation function with immutable js and see the
beautifulness of Js
calculate one time and use it every where
*/
function memoize(fn) {
let prevArg;
let prevResult;
return function (arg) {
@novonimo
novonimo / reducer.js
Created November 13, 2019 08:07
reducerSnippet
case VOTE_COMMENT_SUCCESS:
return {
...state,
comments: state.comments.map(comment =>
comment.id === action.id
? {
...comment,
cached_votes_up: action.data.vote_up,
cached_votes_down: action.data.vote_down,
}
import service from "./service.json";
function sendAvailableArea() {
const headers = {
'x-api-key': process.env.REACT_APP_MAP_IR_ACCESS_TOKEN,
// 'Content-Type': 'multipart/form-data'
};
const formData = new FormData();
//