Skip to content

Instantly share code, notes, and snippets.

View makarovas's full-sized avatar
:dependabot:

Makarov Aleks makarovas

:dependabot:
View GitHub Profile
@makarovas
makarovas / git_cheat-sheet.md
Created January 24, 2018 08:52 — forked from davfre/git_cheat-sheet.md
git commandline cheat-sheet
@makarovas
makarovas / npm-cheat-sheet.md
Created January 26, 2018 07:46 — forked from AvnerCohen/npm-cheat-sheet.md
Node.js - npm Cheat Sheet

Node.js - npm Cheat Sheet

(Full description and list of commands at - https://npmjs.org/doc/index.html)

##List of less common (however useful) NPM commands

######Prepand ./bin to your $PATH Make sure to export your local $PATH and prepand relative ./node_modules/.bin/:

@makarovas
makarovas / nodejs-cheatsheet.js
Created January 26, 2018 07:46 — forked from LeCoupa/nodejs-cheatsheet.js
Complete Node.js CheatSheet --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
/* *******************************************************************************************
* THE UPDATED VERSION IS AVAILABLE AT
* https://github.com/LeCoupa/awesome-cheatsheets
* ******************************************************************************************* */
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
// Load plugins
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
imagemin = require('gulp-imagemin'),
rename = require('gulp-rename'),
clean = require('gulp-clean'),
import React from 'react';
import ReactDOM from 'react-dom';
class AppComponent extends React.Component {
state = {
numChildren: 0
}
render () {
<div id="root">
</div>
.box {
display: block;
width: 200px;
height: 200px;
background-color: gray;
color: white;
The commands are similar to NPM’s:
• Install all packages: npm install or yarn
• Install a certain package: npm install --save <package> or yarn add <package>
• Start the development server: npm start or yarn start
• Run the tests: npm test or yarn test
• Install something globally: yarn global add <package> or npm install -g <package>
yarn global add create-react-app
Например:
var data = {
name: 'Jack',
items: {
dog: 1,
car: 1,
phone: 2,
},
};

Принципы работы jsonp

Скопировать все файлы в одну папку.

Установить http-server, если ещё не установлен:

npm install -g http-server

Запустить сервер:

var jsonData = require('../../file.json');
class blah extends React.Component {
render(){
var data;
function loadJSON(jsonfile, callback) {
var jsonObj = new XMLHttpRequest();