This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Tic Tac Toe</title> | |
<script src="game-lib.js" type="text/javascript"></script> | |
</head> | |
<body> | |
<div id="game_container"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const config = { | |
entry: ['./app/index.js'], | |
output: { | |
path: __dirname + '/build', | |
filename: 'game-lib.js' | |
}, | |
module: { | |
loaders: [ | |
{ | |
loader:'babel-loader', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******/ (function(modules) { // webpackBootstrap | |
/******/ // The module cache | |
/******/ var installedModules = {}; | |
/******/ | |
/******/ // The require function | |
/******/ function __webpack_require__(moduleId) { | |
/******/ | |
/******/ // Check if module is in cache | |
/******/ if(installedModules[moduleId]) { | |
/******/ return installedModules[moduleId].exports; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* global __dirname, require, module*/ | |
const webpack = require('webpack'); | |
const UglifyJsPlugin = webpack.optimize.UglifyJsPlugin; | |
const path = require('path'); | |
const env = require('yargs').argv.env; // use --env with webpack 2 | |
let libraryName = 'game-lib'; | |
let plugins = [], outputFile; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Stage 1 | |
FROM node:8 as react-build | |
WORKDIR /app | |
COPY . ./ | |
RUN yarn | |
RUN yarn build | |
# Stage 2 - the production environment | |
FROM nginx:alpine | |
COPY nginx.conf /etc/nginx/conf.d/default.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.git | |
node_modules | |
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name localhost; | |
#charset koi8-r; | |
#access_log /var/log/nginx/host.access.log main; | |
location / { | |
root /usr/share/nginx/html; | |
index index.html index.htm; | |
try_files $uri /index.html; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const a = [true,false,undefined,null,NaN,"array",5]; | |
console.log('---------Original Array-----------'); | |
console.log(a); // [ true, false, undefined, null, NaN, 'array', 5 ] | |
/*-------Shalow copy-----------*/ | |
console.log('---------Shalow Copying-----------'); | |
//slice | |
console.log('---------Shalow Copying with slice()-----------'); | |
const b = a.slice(); | |
console.log(b); // [ true, false, undefined, null, NaN, 'array', 5 ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getOperatorWeight(op): | |
weights = { | |
'+': 1, | |
'-': 1, | |
'*': 2, | |
'/': 2, | |
'^': 3 | |
} | |
return weights.get(op) | |
def isRightAssociative(op): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react'; | |
import './App.css'; | |
const defaultLocale = localStorage['locale'] ? localStorage['locale'] : 'en'; // English is default locale if none is set | |
const localeList = [ | |
{ name: 'English', code: 'en', lang: 'English' }, | |
{ name: '中文', code: 'zh', lang: 'Chinese' }, | |
{ name: 'русский', code: 'ru', lang: 'Russian' }, | |
{ name: 'Française', code: 'fr', lang: 'French' } | |
]; |
OlderNewer