To create one host nginx for static site:
server {
listen 80;
server_name www.yourhost.com yourhost.com;
import Dispatcher, {EventObject} from "Dispatcher"; | |
/** | |
* Items collection | |
*/ | |
export default class Collection { | |
static E_ADD = 'add'; | |
static E_REMOVE = 'remove'; | |
static E_CHANGE = 'change'; |
// MIT License | |
// @return {float} a random number between min and max | |
function getRandom(min, max) { | |
return Math.random() * (max - min) + min; | |
} | |
// @return {integer} a random int between min and max | |
function getRandomInt(min, max) { | |
return Math.floor(Math.random() * (max - min + 1) + min); |
window.downloadFile = function (sUrl) { | |
//iOS devices do not support downloading. We have to inform user about this. | |
if (/(iP)/g.test(navigator.userAgent)) { | |
alert('Your device does not support files downloading. Please try again in desktop browser.'); | |
return false; | |
} | |
//If in Chrome or Safari - download via virtual link click | |
if (window.downloadFile.isChrome || window.downloadFile.isSafari) { |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<title>array: .native vs .forEach vs .map #jsbench #jsperf</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
<script src="./suite.js"></script> | |
</head> | |
<body> | |
<h1>Open the console to view the results</h1> |
var button = document.createElement('button'); | |
button.onclick = function(e) { alert('clicked button', e); } | |
var clickEvent = new Event('click'); | |
button.dispatchEvent(clickEvent); | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<title>Compare key value and sha1 #jsbench #jsperf</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
<script src="./suite.js"></script> | |
</head> | |
<body> | |
<h1>Open the console to view the results</h1> |
function getPath(el) { | |
var path = el.nodeName; | |
if (el.parentNode && el.parentNode.nodeName !== 'BODY') { | |
path = getPath(el.parentNode) + ' ' + path; | |
} | |
return path.toLowerCase(); | |
} |
/usr/bin/cpp -P -undef -Wundef -std=c99 -nostdinc -Wno-extra-tokens -Wtrigraphs -fdollars-in-identifiers -C file.js |
import React from 'react'; | |
import {TransitionMotion, spring} from 'react-motion'; | |
const willEnter = children => ({children, opacity: spring(0), translate: spring(999)}); | |
const willLeave = (key, {children}) => ({children, opacity: spring(0), translate: spring(-999)}); | |
const getStyles = (children, pathname) => ({[pathname]: {children, opacity: spring(1), translate: spring(0)}}); | |
export default function RouteTransition({children, pathname}) { | |
return ( | |
<TransitionMotion |