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"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<script src="https://web-device.oss-cn-hangzhou.aliyuncs.com/aliyun-iot-device-sdk.min.js?00001"></script> | |
</head> | |
<body> | |
<script> |
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
var http = require('http'), | |
httpProxy = require('http-proxy'); | |
var url = require('url'); | |
var proxy = httpProxy.createProxyServer({}); | |
proxy.on('proxyReq', function(proxyReq, req, res, options) { | |
proxyReq.setHeader('host', req.query.host); | |
}); | |
var server = http.createServer(function(req, res) { |
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 buildBinaryExpression(op, left, right) { | |
return { | |
type: 'BinaryExpression', | |
operator: op, | |
left: left, | |
right: right | |
} | |
} | |
} |
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
ExpressionList | |
= e:Expression* | |
Expression | |
= ae:AssignExpression | |
/ we:WatchExpression | |
AssignExpression | |
= id: Identifier f: Factory "(" (params:ParameterList)? ")" | |
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 buildBinaryExpression(op, left, right) { | |
return { | |
type: 'BinaryExpression', | |
operator: op, | |
left: left, | |
right: right | |
} | |
} | |
} |
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
/* | |
* Simple Intentation-Based Language PEG.js Grammar | |
* ================================================ | |
* | |
* Describes a simple indentation-based language. A program in this language is | |
* a possibly empty list of the following statements: | |
* | |
* * S (simple) | |
* | |
* Consists of the letter "S". |
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
Expression | |
= head:Term tail:(_ ("+" / "-") _ Term)* { | |
var result = head, i; | |
for (i = 0; i < tail.length; i++) { | |
if (tail[i][1] === "+") { result += tail[i][3]; } | |
if (tail[i][1] === "-") { result -= tail[i][3]; } | |
} | |
return result; |
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
'use strict' | |
const EOF = "EOF" | |
class Lexer { | |
constructor(input) { | |
this.input = input | |
this.index = -1 | |
this.currentChar = null | |
this.step() | |
} |
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 mix(origin, target){ | |
var origin = origin || {}; | |
for (var i in target) { | |
origin[i] = target[i]; | |
} | |
return origin; | |
} | |
} |
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
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to make opened Markdown files always be soft wrapped: | |
# | |
# path = require 'path' | |
# |
NewerOlder