Skip to content

Instantly share code, notes, and snippets.

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

Dmitri Petrov Junglecrew

🏠
Working from home
View GitHub Profile
// mobx: 6.3.3
// React 16.8+
interface IStore {
name: string;
}
export const useSelector = <T>(
selector: () => T,
deps: DependencyList = []
@Junglecrew
Junglecrew / gist:46f3514844af52ca9b450cf53045d9c7
Created August 30, 2018 09:10
Linter and Prettier settings
.eslintrc
{
"extends": [
"fbjs",
"prettier"
],
"plugins": [
"prettier"
],
@Junglecrew
Junglecrew / on-jsx.markdown
Last active March 11, 2018 23:59 — forked from chantastic/on-jsx.markdown
JSX, a year in

A component like this would be rejected in code review for having both a presentation and data concern:

// CommentList.js
import React from "react";

class CommentList extends React.Component {
  constructor() {
    super();
    this.state = { comments: [] }
// Get all users
var url = "http://localhost:8080/api/v1/users";
var xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.onload = function () {
var users = JSON.parse(xhr.responseText);
if (xhr.readyState == 4 && xhr.status == "200") {
console.table(users);
} else {
console.error(users);
@Junglecrew
Junglecrew / gist:5e0d7e1e4fbe3917b2db6f06e7c4d74a
Created November 24, 2017 22:01
Поиск данных по адресу для карты Google
http://maps.google.com/maps/api/geocode/xml?address=ТУТПИШЕМАДРЕСБЕЗПРОБЕЛОВ&sensor=false
@Junglecrew
Junglecrew / gist:155457a68d4abc6777f3364b01363310
Created October 10, 2017 19:01
Preloader для страницы
<style>
.loader {
background: none repeat scroll 0 0 #ffffff;
bottom: 0;
height: 100%;
left: 0;
position: fixed;
right: 0;
top: 0;
width: 100%;
HTML:
<div class="wrapper">
<div class="tabs">
<span class="tab">Вкладка 1</span>
<span class="tab">Вкладка 2</span>
<span class="tab">Вкладка 3</span>
</div>
<div class="tab_content">
<div class="tab_item">Содержимое 1</div>
<div class="tab_item">Содержимое 2</div>
function heightDetect(){
$(".main_head").css("height", $(window).height());
};
heightDetect()
$(window).resize(function() {
heightDetect();
});