Initial release

pull/4/head
Alex Dima 9 years ago
parent 90042b4f97
commit 896c60a8b9

2
.gitignore vendored

@ -0,0 +1,2 @@
/node_modules/
/release/

@ -0,0 +1,4 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.trimTrailingWhitespace": true
}

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 Microsoft Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@ -1,2 +1,123 @@
# monaco-editor
A browser based code editor
# Monaco Editor
The Monaco Editor is the code editor that powers [VS Code](https://github.com/Microsoft/vscode), a good page describing the code editor's features is [here](https://code.visualstudio.com/docs/editor/editingevolved).
![image](https://cloud.githubusercontent.com/assets/5047891/15751937/4267b918-28ec-11e6-9fbd-d6cd2973c770.png)
## Issues
This repository contains only the scripts to glue things together, please create issues against the actual repositories where the source code lives:
* monaco-editor-core: [Issues](https://github.com/Microsoft/vscode) -- [npm module](https://www.npmjs.com/package/monaco-editor-core) (Issues with the editor itself)
* monaco-typescript: [Issues](https://github.com/Microsoft/monaco-typescript) -- [npm module](https://www.npmjs.com/package/monaco-typescript) (Issues with JavaScript or TypeScript language support)
* monaco-languages: [Issues](https://github.com/Microsoft/monaco-languages) -- [npm module](https://www.npmjs.com/package/monaco-languages) (Issues with bat, coffee script, cpp, csharp, fsharp, go, ini, jade, lua, objective-c, powershell, python, r, ruby, sql, swift, vb or xml)
## Known issues
In IE, the editor must be completely surrounded in the body element, otherwise the hit testing we do for mouse operations does not work. You can inspect this using F12 and clicking on the body element and confirm that visually it surrounds the editor.
## Installing
```
npm install monaco-editor
```
You will get:
* inside `dev`: bundled, not minified
* inside `min`: bundled, and minified
* inside `min-maps`: source maps for `min`
* `monaco.d.ts`: this specifies the API of the editor (this is what is actually versioned, everything else is considered private and might break with any release).
It is recommended to develop against the `dev` version, and in production to use the `min` version.
## Integrate
Here is the most basic HTML page that embeds the editor. More samples are available at [monaco-editor-samples](https://github.com/Microsoft/monaco-editor-samples).
```html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
</head>
<body>
<div id="container" style="width:800px;height:600px;border:1px solid grey"></div>
<script src="monaco-editor/min/vs/loader.js"></script>
<script>
require.config({ paths: { 'vs': 'monaco-editor/min/vs' }});
require(['vs/editor/editor.main'], function() {
var editor = monaco.editor.create(document.getElementById('container'), {
value: [
'function x() {',
'\tconsole.log("Hello world!");',
'}'
].join('\n'),
language: 'javascript'
});
});
</script>
</body>
</html>
```
## Integrate cross domain
If you are hosting your `.js` on a different domain (e.g. on a CDN) than the HTML, you should know that the Monaco Editor creates web workers for smart language features. Cross-domain web workers are not allowed, but here is how you can proxy their loading and get them to work:
```html
<!--
Assuming the HTML lives on www.mydomain.com and that the editor is hosted on www.mycdn.com
-->
<script type="text/javascript" src="http://www.mycdn.com/monaco-editor/vs/loader.js"></script>
<script>
require.config({ paths: { 'vs': 'http://www.mycdn.com/monaco-editor/min/vs' }});
// Before loading vs/editor/editor.main, define a global MonacoEnvironment that overwrites
// the default worker url location (used when creating WebWorkers). The problem here is that
// HTML5 does not allow cross-domain web workers, so we need to proxy the instantion of
// a web worker through a same-domain script
window.MonacoEnvironment = {
getWorkerUrl: function(workerId, label) {
return 'monaco-editor-worker-loader-proxy.js';
}
};
require(["vs/editor/editor.main"], function () {
// ...
});
</script>
<!--
Create http://www.mydomain.com/monaco-editor-worker-loader-proxy.js with the following content:
self.MonacoEnvironment = {
baseUrl: 'http://www.mycdn.com/monaco-editor/'
};
importScripts('www.mycdn.com/monaco-editor/vs/base/worker/workerMain.js');
That's it. You're good to go! :)
-->
```
## FAQ
* Q: What is the relationship between VS Code and the Monaco Editor?
* A: The Monaco Editor is generated straight from VS Code's sources with some shims around services the code needs to make it run in a web browser outside of its home.
<br/>
* Q: What is the relationship between VS Code's version and the Monaco Editor's version?
* A: None. The Monaco Editor is a library and it reflects directly the source code.
<br/>
* Q: I've written an extension for VS Code, will it work on the Monaco Editor in a browser?
* A: No.
<br/>
* Q: Why all these web workers and why should I care?
* A: Language services create web workers to compute heavy stuff outside the UI thread. They cost hardly anything in terms of resource overhead and you shouldn't worry too much about them, as long as you get them to work (see above the cross-domain case).
<br/>
* Q: What is this `loader.js`? Can I use `require.js`?
* A: It is an AMD loader that we use in VS Code. Yes.
## License
[MIT](https://github.com/Microsoft/monaco-editor/blob/master/LICENSE.md)

@ -0,0 +1,129 @@
var gulp = require('gulp');
var metadata = require('./metadata');
var es = require('event-stream');
var path = require('path');
var fs = require('fs');
var rimraf = require('rimraf');
gulp.task('clean-release', function(cb) { rimraf('release', { maxBusyTries: 1 }, cb); });
gulp.task('release', ['clean-release'], function() {
return es.merge(
// dev folder
releaseOne('dev'),
// min folder
releaseOne('min'),
// package.json
gulp.src('package.json')
.pipe(es.through(function(data) {
var json = JSON.parse(data.contents.toString());
json.private = false;
data.contents = new Buffer(JSON.stringify(json, null, ' '));
this.emit('data', data);
}))
.pipe(gulp.dest('release')),
// min-maps folder
gulp.src('node_modules/monaco-editor-core/min-maps/**/*').pipe(gulp.dest('release/min-maps')),
// other files
gulp.src([
'node_modules/monaco-editor-core/LICENSE',
'node_modules/monaco-editor-core/monaco.d.ts',
'node_modules/monaco-editor-core/ThirdPartyNotices.txt',
'README.md'
]).pipe(gulp.dest('release'))
)
});
function releaseOne(type) {
return es.merge(
gulp.src('node_modules/monaco-editor-core/' + type + '/**/*')
.pipe(addPluginContribs())
.pipe(gulp.dest('release/' + type)),
pluginStreams('release/' + type + '/')
)
}
function mergePluginsContribsIntoCore(coreStream) {
return (
coreStream
.pipe(addPluginContribs())
);
}
function pluginStreams(destinationPath) {
return es.merge(
metadata.METADATA.PLUGINS.map(function(plugin) {
return pluginStream(plugin, destinationPath);
})
);
}
function pluginStream(plugin, destinationPath) {
var contribPath = path.join(plugin.path, plugin.contrib.substr(plugin.modulePrefix.length)) + '.js';
return (
gulp.src([
plugin.path + '/**/*',
'!' + contribPath
])
.pipe(gulp.dest(destinationPath + plugin.modulePrefix))
);
}
/**
* Edit editor.main.js:
* - rename the AMD module 'vs/editor/editor.main' to 'vs/editor/edcore.main'
* - append contribs from plugins
* - append new AMD module 'vs/editor/editor.main' that stiches things together
*/
function addPluginContribs() {
return es.through(function(data) {
if (!/editor\.main\.js$/.test(data.path)) {
this.emit('data', data);
return;
}
var contents = data.contents.toString();
// Rename the AMD module 'vs/editor/editor.main' to 'vs/editor/edcore.main'
contents = contents.replace(/"vs\/editor\/editor\.main\"/, '"vs/editor/edcore.main"');
var extraContent = [];
var allPluginsModuleIds = [];
metadata.METADATA.PLUGINS.forEach(function(plugin) {
allPluginsModuleIds.push(plugin.contrib);
var contribPath = path.join(__dirname, plugin.path, plugin.contrib.substr(plugin.modulePrefix.length)) + '.js';
var contribContents = fs.readFileSync(contribPath).toString();
var contribDefineIndex = contribContents.indexOf('define("' + plugin.contrib);
if (contribDefineIndex === -1) {
console.error('(1) CANNOT DETERMINE AMD define location for contribution', plugin);
process.exit(-1);
}
var depsEndIndex = contribContents.indexOf(']', contribDefineIndex);
if (contribDefineIndex === -1) {
console.error('(2) CANNOT DETERMINE AMD define location for contribution', plugin);
process.exit(-1);
}
contribContents = contribContents.substring(0, depsEndIndex) + ',"vs/editor/edcore.main"' + contribContents.substring(depsEndIndex);
extraContent.push(contribContents);
});
extraContent.push(`define("vs/editor/editor.main", ["vs/editor/edcore.main","${allPluginsModuleIds.join('","')}"], function() {});`);
var insertIndex = contents.lastIndexOf('//# sourceMappingURL=');
if (insertIndex === -1) {
insertIndex = contents.length;
}
contents = contents.substring(0, insertIndex) + '\n' + extraContent.join('\n') + '\n' + contents.substring(insertIndex);
data.contents = new Buffer(contents);
this.emit('data', data);
});
}

@ -0,0 +1,30 @@
(function() {
var METADATA = {
CORE: {
path: 'node_modules/monaco-editor-core/min/vs',
srcPath: '/vscode/out/vs'
// srcPath: '/vscode/out-monaco-editor-core/min/vs'
},
PLUGINS: [{
name: 'monaco-typescript',
contrib: 'vs/language/typescript/src/monaco.contribution',
modulePrefix: 'vs/language/typescript',
path: 'node_modules/monaco-typescript/release',
srcPath: '/monaco-typescript/out'
}, {
name: 'monaco-languages',
contrib: 'vs/basic-languages/src/monaco.contribution',
modulePrefix: 'vs/basic-languages',
path: 'node_modules/monaco-languages/release',
srcPath: '/monaco-languages/out'
}]
}
if (typeof exports !== 'undefined') {
exports.METADATA = METADATA
} else {
self.METADATA = METADATA;
}
})();

@ -0,0 +1,25 @@
{
"name": "monaco-editor",
"private": true,
"version": "0.2.4",
"description": "A browser based code editor",
"author": "Microsoft Corporation",
"license": "MIT",
"scripts": {
"simpleserver": "node_modules/.bin/http-server -c-1 ../",
"release": "node_modules/.bin/gulp release"
},
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/monaco-editor"
},
"devDependencies": {
"event-stream": "^3.3.2",
"gulp": "^3.9.1",
"http-server": "^0.9.0",
"monaco-editor-core": "0.3.1",
"monaco-languages": "0.1.1",
"monaco-typescript": "0.1.1",
"rimraf": "^2.5.2"
}
}

@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="stylesheet" href="./index.css" />
</head>
<body>
<h2>Monaco Editor (running from release)</h2>
<a href="./index.html">[MULTIPLE SOURCES]</a>
&nbsp;|&nbsp;
<a href="./index-release.html">[RELEASED]</a>
&nbsp;|&nbsp;
<a href="./smoketest-release.html">[SMOKETEST]</a>
<br/><br/>
<div id="bar" style="margin-bottom: 6px;"></div>
<div style="clear:both"></div>
<div id="container" style="float:left;width:800px;height:450px;border: 1px solid grey"></div>
<div id="options" style="float:left;width:220px;height:450px;border: 1px solid grey"></div>
<div style="clear:both"></div>
<script src="../release/min/vs/loader.js"></script>
<script>
require.config({
paths: {
'vs': '../release/min/vs'
}
});
require(['vs/editor/editor.main'], function() {
require(['./index'], function() {});
});
</script>
</body>
</html>

@ -0,0 +1,14 @@
.monaco-editor .token.custom-info {
color: grey !important;
}
.monaco-editor .token.custom-error {
color: red !important;
font-weight: bold !important;
font-size: 1.2em !important;
}
.monaco-editor .token.custom-notice {
color: orange !important;
}
.monaco-editor .token.custom-date {
color: green !important;
}

@ -0,0 +1,71 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="stylesheet" href="./index.css" />
</head>
<body>
<h2>Monaco Editor (running from multiple sources)</h2>
<a href="./index.html">[MULTIPLE SOURCES]</a>
&nbsp;|&nbsp;
<a href="./index-release.html">[RELEASED]</a>
&nbsp;|&nbsp;
<a href="./smoketest-release.html">[SMOKETEST]</a>
<br/><br/>
<div id="bar" style="margin-bottom: 6px;"></div>
<div style="clear:both"></div>
<div id="container" style="float:left;width:800px;height:450px;border: 1px solid grey"></div>
<div id="options" style="float:left;width:220px;height:450px;border: 1px solid grey"></div>
<div style="clear:both"></div>
<script src="../metadata.js"></script>
<script>
var RUN_EDITOR_FROM_SOURCE = false; // should run the editor from source? (or from the node module)
var RUN_PLUGINS_FROM_SOURCE = {}; // should run the editor plugins from source? (or from node modules)
RUN_PLUGINS_FROM_SOURCE['monaco-typescript'] = false;
RUN_PLUGINS_FROM_SOURCE['monaco-languages'] = false;
// Resolve paths
if (RUN_EDITOR_FROM_SOURCE) {
METADATA.CORE.path = METADATA.CORE.srcPath;
} else {
METADATA.CORE.path = '/monaco-editor/' + METADATA.CORE.path;
}
METADATA.PLUGINS.forEach(function(plugin) {
if (RUN_PLUGINS_FROM_SOURCE[plugin.name]) {
plugin.path = plugin.srcPath;
} else {
plugin.path = '/monaco-editor/' + plugin.path;
}
});
</script>
<script>document.write('<script src="' + METADATA.CORE.path + '/loader.js"><'+'/script>');</script>
<script>
var pathsConfig = {};
METADATA.PLUGINS.forEach(function(plugin) {
pathsConfig[plugin.modulePrefix] = plugin.path;
});
pathsConfig['vs'] = METADATA.CORE.path;
require.config({
paths: pathsConfig
});
require(['vs/editor/editor.main'], function() {
// At this point we've loaded the monaco-editor-core
require(METADATA.PLUGINS.map(function(plugin) { return plugin.contrib; }), function() {
// At this point we've loaded all the plugins
require(['./index'], function() {});
});
});
</script>
</body>
</html>

@ -0,0 +1,372 @@
/// <reference path="../node_modules/monaco-editor-core/monaco.d.ts" />
define(['./samples'], function(SAMPLES) {
var WRAPPING_COLUMN = 300;
var model = monaco.editor.createModel('', 'plaintext');
var editor = monaco.editor.create(document.getElementById('container'), {
model: model,
readOnly: false,
glyphMargin: true,
wrappingColumn: WRAPPING_COLUMN,
outlineMarkers: false,
renderWhitespace: true,
// scrollbar: {
// verticalHasArrows: true,
// horizontalHasArrows: true
// }
});
editor.addCommand({
ctrlCmd: true,
key: 'F9'
}, function(ctx, args) {
alert('Command Running!!');
console.log(ctx);
});
editor.addAction({
id: 'my-unique-id',
label: 'My Label!!!',
keybindings: [
{
ctrlCmd: true,
key: 'F10'
}
],
enablement: {
textFocus: true,
wordAtPosition: true,
tokensAtPosition: ['identifier', '', 'keyword'],
},
contextMenuGroupId: '2_change/2_bla',
run: function(ed) {
console.log("i'm running => " + ed.getPosition());
}
});
var currentSamplePromise = null;
var samplesData = {};
SAMPLES.sort(function(a,b) {
return a.name.localeCompare(b.name);
}).forEach(function(sample) {
samplesData[sample.name] = function() {
if (currentSamplePromise !== null) {
currentSamplePromise.cancel();
currentSamplePromise = null;
}
currentSamplePromise = sample.loadText().then(function(modelText) {
currentSamplePromise = null;
updateEditor(sample.mimeType, modelText, sample.name);
});
}
});
var examplesComboBox = new ComboBox('Template', samplesData);
var modesData = {};
monaco.languages.getLanguages().forEach(function(language) {
modesData[language.id] = updateEditor.bind(this, language.id);
});
var modesComboBox = new ComboBox ('Mode', modesData);
// Do it in a timeout to simplify profiles
window.setTimeout(function () {
var START_SAMPLE = 'Y___DefaultJS';
var url_matches = location.search.match(/sample=([^?&]+)/i);
if (url_matches) {
START_SAMPLE = url_matches[1];
}
if (location.hash) {
START_SAMPLE = location.hash.replace(/^\#/, '');
}
samplesData[START_SAMPLE]();
examplesComboBox.set(START_SAMPLE);
createOptions(editor);
createToolbar(editor);
}, 0);
function updateEditor(mode, value, sampleName) {
if (sampleName) {
window.location.hash = sampleName;
}
if (typeof value !== 'undefined') {
var oldModel = model;
model = monaco.editor.createModel(value, mode);
editor.setModel(model);
if (oldModel) {
oldModel.dispose();
}
} else {
monaco.editor.setModelLanguage(model, mode);
}
modesComboBox.set(mode);
}
function createToolbar(editor) {
var bar = document.getElementById('bar');
bar.appendChild(examplesComboBox.domNode);
bar.appendChild(modesComboBox.domNode);
bar.appendChild(createButton("Dispose all", function (e) {
editor.dispose();
editor = null;
if (model) {
model.dispose();
model = null;
}
}));
bar.appendChild(createButton("Remove Model", function(e) {
editor.setModel(null);
}));
bar.appendChild(createButton("Dispose Model", function(e) {
if (model) {
model.dispose();
model = null;
}
}));
bar.appendChild(createButton('Ballistic scroll', (function() {
var friction = 1000; // px per second
var speed = 0; // px per second
var isRunning = false;
var lastTime;
var r = 0;
var scroll = function() {
var currentTime = new Date().getTime();
var ellapsedTimeS = (currentTime - lastTime) / 1000;
lastTime = currentTime;
speed = speed - friction * ellapsedTimeS;
r = r + speed * ellapsedTimeS;
editor.setScrollTop(r);
if (speed >= 0) {
domutils.scheduleAtNextAnimationFrame(scroll);
} else {
isRunning = false;
}
}
return function (e) {
speed += 2000;
if (!isRunning) {
isRunning = true;
r = editor.getScrollTop();
lastTime = new Date().getTime();
domutils.runAtThisOrScheduleAtNextAnimationFrame(scroll);
}
};
})()));
bar.appendChild(createButton("Colorize", function(e) {
var out = document.getElementById('colorizeOutput');
monaco.editor.colorize(editor.getModel().getValue(), editor.getModel().getMode().getId(), { tabSize: 4 }).then(function(r) {
out.innerHTML = r;
});
}));
}
function createButton(label, onClick) {
var result = document.createElement("button");
result.innerHTML = label;
result.onclick = onClick;
return result;
}
function createOptions(editor) {
var options = document.getElementById('options');
options.appendChild(createOptionToggle(editor, 'lineNumbers', function(config) {
return config.viewInfo.lineNumbers;
}, function(editor, newValue) {
editor.updateOptions({ lineNumbers: newValue });
}));
options.appendChild(createOptionToggle(editor, 'glyphMargin', function(config) {
return config.viewInfo.glyphMargin;
}, function(editor, newValue) {
editor.updateOptions({ glyphMargin: newValue });
}));
options.appendChild(createOptionToggle(editor, 'roundedSelection', function(config) {
return config.viewInfo.roundedSelection;
}, function(editor, newValue) {
editor.updateOptions({ roundedSelection: newValue });
}));
options.appendChild(createOptionToggle(editor, 'dark', function(config) {
return config.viewInfo.theme === 'vs-dark';
}, function(editor, newValue) {
editor.updateOptions({ theme: newValue ? 'vs-dark' : 'vs' });
}));
options.appendChild(createOptionToggle(editor, 'readOnly', function(config) {
return config.readOnly;
}, function(editor, newValue) {
editor.updateOptions({ readOnly: newValue });
}));
options.appendChild(createOptionToggle(editor, 'hideCursorInOverviewRuler', function(config) {
return config.viewInfo.hideCursorInOverviewRuler;
}, function(editor, newValue) {
editor.updateOptions({ hideCursorInOverviewRuler: newValue });
}));
options.appendChild(createOptionToggle(editor, 'scrollBeyondLastLine', function(config) {
return config.viewInfo.scrollBeyondLastLine;
}, function(editor, newValue) {
editor.updateOptions({ scrollBeyondLastLine: newValue });
}));
options.appendChild(createOptionToggle(editor, 'wordWrap', function(config) {
return config.wrappingInfo.isViewportWrapping;
}, function(editor, newValue) {
editor.updateOptions({ wrappingColumn: newValue ? 0 : WRAPPING_COLUMN });
}));
options.appendChild(createOptionToggle(editor, 'quickSuggestions', function(config) {
return config.contribInfo.quickSuggestions;
}, function(editor, newValue) {
editor.updateOptions({ quickSuggestions: newValue });
}));
options.appendChild(createOptionToggle(editor, 'iconsInSuggestions', function(config) {
return config.contribInfo.iconsInSuggestions;
}, function(editor, newValue) {
editor.updateOptions({ iconsInSuggestions: newValue });
}));
options.appendChild(createOptionToggle(editor, 'autoClosingBrackets', function(config) {
return config.autoClosingBrackets;
}, function(editor, newValue) {
editor.updateOptions({ autoClosingBrackets: newValue });
}));
options.appendChild(createOptionToggle(editor, 'formatOnType', function(config) {
return config.contribInfo.formatOnType;
}, function(editor, newValue) {
editor.updateOptions({ formatOnType: newValue });
}));
options.appendChild(createOptionToggle(editor, 'suggestOnTriggerCharacters', function(config) {
return config.contribInfo.suggestOnTriggerCharacters;
}, function(editor, newValue) {
editor.updateOptions({ suggestOnTriggerCharacters: newValue });
}));
options.appendChild(createOptionToggle(editor, 'acceptSuggestionOnEnter', function(config) {
return config.contribInfo.acceptSuggestionOnEnter;
}, function(editor, newValue) {
editor.updateOptions({ acceptSuggestionOnEnter: newValue });
}));
options.appendChild(createOptionToggle(editor, 'selectionHighlight', function(config) {
return config.contribInfo.selectionHighlight;
}, function(editor, newValue) {
editor.updateOptions({ selectionHighlight: newValue });
}));
options.appendChild(createOptionToggle(editor, 'folding', function(config) {
return config.contribInfo.folding;
}, function(editor, newValue) {
editor.updateOptions({ folding: newValue });
}));
options.appendChild(createOptionToggle(editor, 'renderWhitespace', function(config) {
return config.viewInfo.renderWhitespace;
}, function(editor, newValue) {
editor.updateOptions({ renderWhitespace: newValue });
}));
}
function createOptionToggle(editor, labelText, stateReader, setState) {
var domNode = document.createElement('div');
domNode.className = 'option toggle';
var input = document.createElement('input');
input.type = 'checkbox';
var label = document.createElement('label');
label.appendChild(input);
label.appendChild(document.createTextNode(labelText));
domNode.appendChild(label);
var renderState = function() {
input.checked = stateReader(editor.getConfiguration());
};
renderState();
editor.onDidChangeConfiguration(function() {
renderState();
});
input.onchange = function() {
setState(editor, !stateReader(editor.getConfiguration()));
};
return domNode;
}
function ComboBox(label, externalOptions) {
this.id = 'combobox-' + label.toLowerCase().replace(/\s/g, '-');
this.domNode = document.createElement('div');
this.domNode.setAttribute('style', 'display: inline; margin-right: 5px;');
this.label = document.createElement('label');
this.label.innerHTML = label;
this.label.setAttribute('for', this.id);
this.domNode.appendChild(this.label);
this.comboBox = document.createElement('select');
this.comboBox.setAttribute('id', this.id);
this.comboBox.setAttribute('name', this.id);
this.comboBox.onchange =(function (e) {
var target = e.target || e.srcElement;
this.options[target.options[target.selectedIndex].value].callback();
}).bind(this);
this.domNode.appendChild(this.comboBox);
this.options = [];
for (var name in externalOptions) {
if (externalOptions.hasOwnProperty(name)) {
var optionElement = document.createElement('option');
optionElement.value = name;
optionElement.innerHTML = name;
this.options[name] = {
element: optionElement,
callback: externalOptions[name]
};
this.comboBox.appendChild(optionElement);
}
}
}
ComboBox.prototype.set = function (name) {
if (this.options[name]) {
this.options[name].element.selected = true;
}
};
});

@ -0,0 +1,271 @@
/// <reference path="../node_modules/monaco-editor-core/monaco.d.ts" />
define([], function() {
var samples = [];
var modesIds = monaco.languages.getLanguages().map(function(language) { return language.id; });
modesIds.sort();
modesIds.forEach(function(modeId) {
samples.push({
name: 'sample - ' + modeId,
mimeType: modeId,
loadText: function() {
return xhr('samples/sample.' + modeId + '.txt').then(function(xhrResponse) {
return xhrResponse.responseText;
});
}
});
});
function addXHRSample(name, modelUrl, mimeType, textModifier) {
textModifier = textModifier || function(text) { return text; };
samples.push({
name: name,
mimeType: mimeType,
loadText: function() {
return xhr('samples/' + modelUrl).then(function(xhrResponse) {
return textModifier(xhrResponse.responseText);
});
}
});
}
function addStringPowerXHRSample(name, modelUrl, mimeType, power) {
addXHRSample(name, modelUrl, mimeType, function(text) {
var result = text;
for (var i = 0; i < power; ++i) {
result += "\n" + result;
}
return result;
});
}
function addSample(name, mimeType, modelText) {
samples.push({
name: name,
mimeType: mimeType,
loadText: function() {
return monaco.Promise.as(modelText);
}
});
}
addXHRSample('Y___FailingJS', 'run-editor-failing-js.txt', 'text/javascript');
addXHRSample('Y___DefaultJS', 'run-editor-sample-js.txt', 'text/javascript');
addStringPowerXHRSample('Y___BigJS', 'run-editor-sample-js.txt', 'text/javascript', 11);
addXHRSample('Y___BigJS_msn', 'run-editor-sample-msn-js.txt', 'text/javascript');
addXHRSample('Y___BigCSS', 'run-editor-sample-big-css.txt', 'text/css');
addStringPowerXHRSample('Y___BigHTML', 'run-editor-sample-html.txt', 'text/html', 10);
addXHRSample('Y___Korean', 'run-editor-korean.txt', 'text/plain');
addXHRSample('Y___BOM.cs', 'run-editor-sample-bom-cs.txt', 'text/x-csharp');
addXHRSample('Z___CR.ps1', 'run-editor-sample-cr-ps1.txt', 'text/x-powershell');
addXHRSample('Z___jquery-min.js', 'run-editor-jquery-min-js.txt', 'text/javascript');
addXHRSample('Z___scrolling-strategy.js', 'run-editor-sample-js.txt', 'text/plain', function(text) {
var lines = text.split('\n');
var newLines = lines.slice(0);
var problemIsAt = 80733 + 5;
while (newLines.length < problemIsAt) {
newLines = newLines.concat(lines);
}
newLines = newLines.slice(0, problemIsAt);
return newLines.join('\n');
});
addSample('Z___special-chars', 'text/plain', [
"// single line \u000D comment", // Carriage return
"// single line \u2028 comment", // Line separator
"// single line \u2029 comment" // Paragraph separator
].join('\n'));
// http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt
addSample('Z___invalid-unicode', 'text/plain', [
'\uFFFE\uFFFF',
'\uD800\uDC00',
'\uD800\uDFFF',
'\uDB7F\uDC00',
'\uDB7F\uDFFF',
'\uDB80\uDC00',
'\uDB80\uDFFF',
'\uDBFF\uDC00',
'\uDBFF\uDFFF'
].join('\n'));
addSample('Z___easy-debug.js', 'text/plain', (function() {
var myValue = "Line1";
for (var i = 2; i < 50; i++) {
myValue += "\nLine" + i;
}
return myValue;
})());
addSample('Z___copy-paste.txt', 'text/plain', (function() {
var i = 0, sampleCopyPasteLine = '';
while (sampleCopyPasteLine.length < 1000) {
i++;
sampleCopyPasteLine += i;
}
var sampleCopyPaste = sampleCopyPasteLine;
for (i = 1; i <= 600; i++) {
sampleCopyPaste += '\n' + sampleCopyPasteLine;
}
return sampleCopyPaste;
})());
addSample('Z___xss', 'text/html', (function() {
var xssRepresentations = [
'<',
'BAD\u2028CHARACTER',
'%3C',
'&lt',
'&lt;',
'&LT',
'&LT;',
'&#60',
'&#060',
'&#0060',
'&#00060',
'&#000060',
'&#0000060',
'&#60;',
'&#060;',
'&#0060;',
'&#00060;',
'&#000060;',
'&#0000060;',
'&#x3c',
'&#x03c',
'&#x003c',
'&#x0003c',
'&#x00003c',
'&#x000003c',
'&#x3c;',
'&#x03c;',
'&#x003c;',
'&#x0003c;',
'&#x00003c;',
'&#x000003c;',
'&#X3c',
'&#X03c',
'&#X003c',
'&#X0003c',
'&#X00003c',
'&#X000003c',
'&#X3c;',
'&#X03c;',
'&#X003c;',
'&#X0003c;',
'&#X00003c;',
'&#X000003c;',
'&#x3C',
'&#x03C',
'&#x003C',
'&#x0003C',
'&#x00003C',
'&#x000003C',
'&#x3C;',
'&#x03C;',
'&#x003C;',
'&#x0003C;',
'&#x00003C;',
'&#x000003C;',
'&#X3C',
'&#X03C',
'&#X003C',
'&#X0003C',
'&#X00003C',
'&#X000003C',
'&#X3C;',
'&#X03C;',
'&#X003C;',
'&#X0003C;',
'&#X00003C;',
'&#X000003C;',
'\x3c',
'\x3C',
'\u003c',
'\u003C'
];
return xssRepresentations.length + ':\n' + xssRepresentations.join('\n');
})());
addSample('Z___many-links.js', 'text/javascript', (function() {
var result = "bla bla a url: https://microsoft.com some more bla bla";
for (var i = 0; i < 13; ++i) {
result += "\n" + result;
}
return "/*" + result + "\n*/";
})());
addSample('Z___line-separators.js', 'text/javascript', (function() {
return [
"var x = '1'; // And\u2028 here I have a nice comment.",
"",
"var y = x + ' +\u2028 2 = res';",
"",
"y.replace(/re\u2028s/gi, '3');"
].join('\n');
})());
addXHRSample('Z___intellisense.js', 'run-editor-intellisense-js.txt', 'text/javascript');
addSample('Z___recursion attack', 'text/html', (function() {
var arr = [];
for (var i = 0; i < 10000; i++) {
arr.push('\n<script type="text/html">');
}
return arr.length + ':\n' + arr.join('');
})());
addSample('empty', 'text/plain', '');
addXHRSample('Z___dynamic', 'run-editor-sample-dynamic.txt', {
name: 'custom.1.',
tokenizer: {
root: [
[/\[error.*/, "custom-error"],
[/\[notice.*/, "custom-notice"],
[/\[info.*/, "custom-info"],
[/\[[a-zA-Z 0-9:]+\]/, "custom-date"],
],
}
});
addXHRSample('Z___f12___css','run-editor-sample-f12-css.txt','text/css');
return samples;
function xhr(url) {
var req = null;
return new monaco.Promise(function(c,e,p) {
req = new XMLHttpRequest();
req.onreadystatechange = function () {
if (req._canceled) { return; }
if (req.readyState === 4) {
if ((req.status >= 200 && req.status < 300) || req.status === 1223) {
c(req);
} else {
e(req);
}
req.onreadystatechange = function () { };
} else {
p(req);
}
};
req.open("GET", url, true );
req.responseType = "";
req.send(null);
}, function () {
req._canceled = true;
req.abort();
});
}
});

@ -0,0 +1,44 @@
var container = document.getElementById("container");
var cssCode = [
'body {',
' margin: 0px;',
' padding: 0px;',
'}'
].join('\n');
Monaco.Editor.create(container, {
value: cssCode,
mode: "text/css"
});
require(['vs/platform/platform', 'vs/editor/modes/modesExtensions'],
function (Platform, ModesExtensions) {
var modesRegistry = Platform.Registry.as(ModesExtensions.Extensions.EditorModes);
// Try 'ignore', 'warning', and 'error'
modesRegistry.configureMode('text/css', {
"validationSettings": {
"lint": {
compatibleVendorPrefixes": "warning",
vendorPrefix": "warning",
duplicateProperties": "warning",
emptyRules": "warning",
importStatement": "ignore",
boxModel": "ignore",
universalSelector": "warning",
zeroUnits": "ignore",
fontFaceProperties": "warning",
hexColorLength": "error",
argumentsInColorFunction": "error",
unknownProperties": "warning",
unknownVendorSpecificProperties": "warning",
propertyIgnoredDueToDisplay": "warning",
important": "ignore",
float": "ignore",
idSelector": "ignore"
}
}
});
}
);

@ -0,0 +1,33 @@
"use strict";
function Person(age) {
if (age) {
this.age = age;
}
}
Person.prototype.getAge = function () {
return this.age;
};
function Student(age, grade) {
Person.call(this, age);
this.grade = grade;
}
Student.prototype = new Person();
Student.prototype.getGrade = function () {
return this.grade;
};
var s = new Student(24, 5.75);
//var age = s.
//delete s.age;
//s.getAge = function() { return {foo:"bar"}; };
//s.
//s.getAge().

File diff suppressed because one or more lines are too long

@ -0,0 +1,30 @@
define([
'vs/base/common/severity'
], function(severity) {
'use strict';
function ValidateParticipant() {
}
ValidateParticipant.ID = 'doc.validateParticipant';
ValidateParticipant.prototype.validate = function(mirrorModel, markerService) {
var marker = {
severity: severity.Error,
message: [
{ isText: true, text: '\u2188 ' },
{ tagName: 'span', style: 'color:red', text: 'I AM' },
{ isText: true, text: ' A VALIDATION PARTICIPANT \u2188' }
],
startLineNumber: 1,
startColumn: 1,
endLineNumber: 1,
endColumn: 3
};
markerService.changeOne(ValidateParticipant.ID, mirrorModel.getAssociatedResource(), [marker]);
};
return {
ValidateParticipant: ValidateParticipant
};
});

@ -0,0 +1,10 @@
/*
전문
유구한 역사와 전통에 빛나는 우리 대한 국민은 3·1 운동으로 건립된 대한민국 임시 정부의 법통과 불의에 항거한 4·19 민주 이념을 계승하고, 조국의 민주 개혁과 평화적 통일의 사명에 입각하여 정의·인도와 동포애로써 민족의 단결을 공고히 하고, 모든 사회적 폐습과 불의를 타파하며, 자율과 조화를 바탕으로 자유 민주적 기본 질서를 더욱 확고히 하여 정치·경제·사회·문화의 모든 영역에 있어서 각인의 기회를 균등히 하고, 능력을 최고도로 발휘하게 하며, 자유와 권리에 따르는 책임과 의무를 완수하게 하여, 안으로는 국민 생활의 균등한 향상을 기하고 밖으로는 항구적인 세계 평화와 인류 공영에 이바지함으로써 우리들과 우리들의 자손의 안전과 자유와 행복을 영원히 확보할 것을 다짐하면서 1948년 7월 12일에 제정되고 8차에 걸쳐 개정된 헌법을 이제 국회의 의결을 거쳐 국민 투표에 의하여 개정한다.
1987년 10월 29일
前文
悠久한 歷史와 傳統에 빛나는 우리 大韓國民은 3·1 運動으로 建立된 大韓民國臨時政府의 法統과 不義에 抗拒한 4·19 民主理念을 繼承하고, 祖國의 民主改革과 平和的統一의 使命에 立脚하여 正義·人道와 同胞愛로써 民族의 團結을 鞏固히 하고, 모든 社會的弊習과 不義를 打破하며, 自律과 調和를 바탕으로 自由民主的基本秩序를 더욱 確固히 하여 政治·經濟·社會·文化의 모든 領域에 있어서 各人의 機會를 均等히 하고, 能力을 最高度로 發揮하게 하며, 自由와 權利에 따르는 責任과 義務를 完遂하게 하여, 안으로는 國民生活의 均等한 向上을 基하고 밖으로는 恒久的인 世界平和와 人類共榮에 이바지함으로써 우리들과 우리들의 子孫의 安全과 自由와 幸福을 永遠히 確保할 것을 다짐하면서 1948年 7月 12日에 制定되고 8次에 걸쳐 改正된 憲法을 이제 國會의 議決을 거쳐 國民投票에 依하여 改正한다.
1987年 10月 29日
*/

File diff suppressed because one or more lines are too long

@ -0,0 +1,493 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Security.Claims;
using System.Security.Cryptography;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using System.Web.Http.ModelBinding;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Cookies;
using Microsoft.Owin.Security.OAuth;
using WebApplication.Models;
using WebApplication.Providers;
using WebApplication.Results;
namespace WebApplication.Controllers
{
[Authorize]
[RoutePrefix("api/Account")]
public class AccountController : ApiController
{
private const string LocalLoginProvider = "Local";
private ApplicationUserManager _userManager;
public AccountController()
{
}
public AccountController(ApplicationUserManager userManager,
ISecureDataFormat<AuthenticationTicket> accessTokenFormat)
{
UserManager = userManager;
AccessTokenFormat = accessTokenFormat;
}
public ApplicationUserManager UserManager
{
get
{
return _userManager ?? Request.GetOwinContext().GetUserManager<ApplicationUserManager>();
}
private set
{
_userManager = value;
}
}
public ISecureDataFormat<AuthenticationTicket> AccessTokenFormat { get; private set; }
// GET api/Account/UserInfo
[HostAuthentication(DefaultAuthenticationTypes.ExternalBearer)]
[Route("UserInfo")]
public UserInfoViewModel GetUserInfo()
{
ExternalLoginData externalLogin = ExternalLoginData.FromIdentity(User.Identity as ClaimsIdentity);
return new UserInfoViewModel
{
Email = User.Identity.GetUserName(),
HasRegistered = externalLogin == null,
LoginProvider = externalLogin != null ? externalLogin.LoginProvider : null
};
}
// POST api/Account/Logout
[Route("Logout")]
public IHttpActionResult Logout()
{
Authentication.SignOut(CookieAuthenticationDefaults.AuthenticationType);
return Ok();
}
// GET api/Account/ManageInfo?returnUrl=%2F&generateState=true
[Route("ManageInfo")]
public async Task<ManageInfoViewModel> GetManageInfo(string returnUrl, bool generateState = false)
{
IdentityUser user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
if (user == null)
{
return null;
}
List<UserLoginInfoViewModel> logins = new List<UserLoginInfoViewModel>();
foreach (IdentityUserLogin linkedAccount in user.Logins)
{
logins.Add(new UserLoginInfoViewModel
{
LoginProvider = linkedAccount.LoginProvider,
ProviderKey = linkedAccount.ProviderKey
});
}
if (user.PasswordHash != null)
{
logins.Add(new UserLoginInfoViewModel
{
LoginProvider = LocalLoginProvider,
ProviderKey = user.UserName,
});
}
return new ManageInfoViewModel
{
LocalLoginProvider = LocalLoginProvider,
Email = user.UserName,
Logins = logins,
ExternalLoginProviders = GetExternalLogins(returnUrl, generateState)
};
}
// POST api/Account/ChangePassword
[Route("ChangePassword")]
public async Task<IHttpActionResult> ChangePassword(ChangePasswordBindingModel model)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
IdentityResult result = await UserManager.ChangePasswordAsync(User.Identity.GetUserId(), model.OldPassword,
model.NewPassword);
if (!result.Succeeded)
{
return GetErrorResult(result);
}
return Ok();
}
// POST api/Account/SetPassword
[Route("SetPassword")]
public async Task<IHttpActionResult> SetPassword(SetPasswordBindingModel model)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
IdentityResult result = await UserManager.AddPasswordAsync(User.Identity.GetUserId(), model.NewPassword);
if (!result.Succeeded)
{
return GetErrorResult(result);
}
return Ok();
}
// POST api/Account/AddExternalLogin
[Route("AddExternalLogin")]
public async Task<IHttpActionResult> AddExternalLogin(AddExternalLoginBindingModel model)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
Authentication.SignOut(DefaultAuthenticationTypes.ExternalCookie);
AuthenticationTicket ticket = AccessTokenFormat.Unprotect(model.ExternalAccessToken);
if (ticket == null || ticket.Identity == null || (ticket.Properties != null
&& ticket.Properties.ExpiresUtc.HasValue
&& ticket.Properties.ExpiresUtc.Value < DateTimeOffset.UtcNow))
{
return BadRequest("External login failure.");
}
ExternalLoginData externalData = ExternalLoginData.FromIdentity(ticket.Identity);
if (externalData == null)
{
return BadRequest("The external login is already associated with an account.");
}
IdentityResult result = await UserManager.AddLoginAsync(User.Identity.GetUserId(),
new UserLoginInfo(externalData.LoginProvider, externalData.ProviderKey));
if (!result.Succeeded)
{
return GetErrorResult(result);
}
return Ok();
}
// POST api/Account/RemoveLogin
[Route("RemoveLogin")]
public async Task<IHttpActionResult> RemoveLogin(RemoveLoginBindingModel model)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
IdentityResult result;
if (model.LoginProvider == LocalLoginProvider)
{
result = await UserManager.RemovePasswordAsync(User.Identity.GetUserId());
}
else
{
result = await UserManager.RemoveLoginAsync(User.Identity.GetUserId(),
new UserLoginInfo(model.LoginProvider, model.ProviderKey));
}
if (!result.Succeeded)
{
return GetErrorResult(result);
}
return Ok();
}
// GET api/Account/ExternalLogin
[OverrideAuthentication]
[HostAuthentication(DefaultAuthenticationTypes.ExternalCookie)]
[AllowAnonymous]
[Route("ExternalLogin", Name = "ExternalLogin")]
public async Task<IHttpActionResult> GetExternalLogin(string provider, string error = null)
{
if (error != null)
{
return Redirect(Url.Content("~/") + "#error=" + Uri.EscapeDataString(error));
}
if (!User.Identity.IsAuthenticated)
{
return new ChallengeResult(provider, this);
}
ExternalLoginData externalLogin = ExternalLoginData.FromIdentity(User.Identity as ClaimsIdentity);
if (externalLogin == null)
{
return InternalServerError();
}
if (externalLogin.LoginProvider != provider)
{
Authentication.SignOut(DefaultAuthenticationTypes.ExternalCookie);
return new ChallengeResult(provider, this);
}
ApplicationUser user = await UserManager.FindAsync(new UserLoginInfo(externalLogin.LoginProvider,
externalLogin.ProviderKey));
bool hasRegistered = user != null;
if (hasRegistered)
{
Authentication.SignOut(DefaultAuthenticationTypes.ExternalCookie);
ClaimsIdentity oAuthIdentity = await user.GenerateUserIdentityAsync(UserManager,
OAuthDefaults.AuthenticationType);
ClaimsIdentity cookieIdentity = await user.GenerateUserIdentityAsync(UserManager,
CookieAuthenticationDefaults.AuthenticationType);
AuthenticationProperties properties = ApplicationOAuthProvider.CreateProperties(user.UserName);
Authentication.SignIn(properties, oAuthIdentity, cookieIdentity);
}
else
{
IEnumerable<Claim> claims = externalLogin.GetClaims();
ClaimsIdentity identity = new ClaimsIdentity(claims, OAuthDefaults.AuthenticationType);
Authentication.SignIn(identity);
}
return Ok();
}
// GET api/Account/ExternalLogins?returnUrl=%2F&generateState=true
[AllowAnonymous]
[Route("ExternalLogins")]
public IEnumerable<ExternalLoginViewModel> GetExternalLogins(string returnUrl, bool generateState = false)
{
IEnumerable<AuthenticationDescription> descriptions = Authentication.GetExternalAuthenticationTypes();
List<ExternalLoginViewModel> logins = new List<ExternalLoginViewModel>();
string state;
if (generateState)
{
const int strengthInBits = 256;
state = RandomOAuthStateGenerator.Generate(strengthInBits);
}
else
{
state = null;
}
foreach (AuthenticationDescription description in descriptions)
{
ExternalLoginViewModel login = new ExternalLoginViewModel
{
Name = description.Caption,
Url = Url.Route("ExternalLogin", new
{
provider = description.AuthenticationType,
response_type = "token",
client_id = Startup.PublicClientId,
redirect_uri = new Uri(Request.RequestUri, returnUrl).AbsoluteUri,
state = state
}),
State = state
};
logins.Add(login);
}
return logins;
}
// POST api/Account/Register
[AllowAnonymous]
[Route("Register")]
public async Task<IHttpActionResult> Register(RegisterBindingModel model)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
var user = new ApplicationUser() { UserName = model.Email, Email = model.Email };
IdentityResult result = await UserManager.CreateAsync(user, model.Password);
if (!result.Succeeded)
{
return GetErrorResult(result);
}
return Ok();
}
// POST api/Account/RegisterExternal
[OverrideAuthentication]
[HostAuthentication(DefaultAuthenticationTypes.ExternalBearer)]
[Route("RegisterExternal")]
public async Task<IHttpActionResult> RegisterExternal(RegisterExternalBindingModel model)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
var info = await Authentication.GetExternalLoginInfoAsync();
if (info == null)
{
return InternalServerError();
}
var user = new ApplicationUser() { UserName = model.Email, Email = model.Email };
IdentityResult result = await UserManager.CreateAsync(user);
if (!result.Succeeded)
{
return GetErrorResult(result);
}
result = await UserManager.AddLoginAsync(user.Id, info.Login);
if (!result.Succeeded)
{
return GetErrorResult(result);
}
return Ok();
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
UserManager.Dispose();
}
base.Dispose(disposing);
}
#region Helpers
private IAuthenticationManager Authentication
{
get { return Request.GetOwinContext().Authentication; }
}
private IHttpActionResult GetErrorResult(IdentityResult result)
{
if (result == null)
{
return InternalServerError();
}
if (!result.Succeeded)
{
if (result.Errors != null)
{
foreach (string error in result.Errors)
{
ModelState.AddModelError("", error);
}
}
if (ModelState.IsValid)
{
// No ModelState errors are available to send, so just return an empty BadRequest.
return BadRequest();
}
return BadRequest(ModelState);
}
return null;
}
private class ExternalLoginData
{
public string LoginProvider { get; set; }
public string ProviderKey { get; set; }
public string UserName { get; set; }
public IList<Claim> GetClaims()
{
IList<Claim> claims = new List<Claim>();
claims.Add(new Claim(ClaimTypes.NameIdentifier, ProviderKey, null, LoginProvider));
if (UserName != null)
{
claims.Add(new Claim(ClaimTypes.Name, UserName, null, LoginProvider));
}
return claims;
}
public static ExternalLoginData FromIdentity(ClaimsIdentity identity)
{
if (identity == null)
{
return null;
}
Claim providerKeyClaim = identity.FindFirst(ClaimTypes.NameIdentifier);
if (providerKeyClaim == null || String.IsNullOrEmpty(providerKeyClaim.Issuer)
|| String.IsNullOrEmpty(providerKeyClaim.Value))
{
return null;
}
if (providerKeyClaim.Issuer == ClaimsIdentity.DefaultIssuer)
{
return null;
}
return new ExternalLoginData
{
LoginProvider = providerKeyClaim.Issuer,
ProviderKey = providerKeyClaim.Value,
UserName = identity.FindFirstValue(ClaimTypes.Name)
};
}
}
private static class RandomOAuthStateGenerator
{
private static RandomNumberGenerator _random = new RNGCryptoServiceProvider();
public static string Generate(int strengthInBits)
{
const int bitsPerByte = 8;
if (strengthInBits % bitsPerByte != 0)
{
throw new ArgumentException("strengthInBits must be evenly divisible by 8.", "strengthInBits");
}
int strengthInBytes = strengthInBits / bitsPerByte;
byte[] data = new byte[strengthInBytes];
_random.GetBytes(data);
return HttpServerUtility.UrlTokenEncode(data);
}
}
#endregion
}
}

@ -0,0 +1,12 @@
# A line that ends only in CR(0x0D) and not LF (0x0A). foreach($parameterSet in $ObjInfoArray)
{
# This line also ends only in CR(0x0D) and not LF (0x0A). if ($parameterSet["class"] -eq "blank")
{
if ($XenCenterNodeSelected)
{
continue
}
$XenCenterNodeSelected = 1; $SelectedObjectNames += "XenCenter"
}
}

@ -0,0 +1,50 @@
[Sun Mar 7 16:02:00 2004] [notice] Apache/1.3.29 (Unix) configured -- resuming normal operations
[Sun Mar 7 16:02:00 2004] [info] Server built: Feb 27 2004 13:56:37
[Sun Mar 7 16:02:00 2004] [notice] Accept mutex: sysvsem (Default: sysvsem)
[Sun Mar 7 16:05:49 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Sun Mar 7 16:45:56 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Sun Mar 7 17:13:50 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Sun Mar 7 17:21:44 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Sun Mar 7 17:23:53 2004] statistics: Use of uninitialized value in concatenation (.) or string at /home/httpd/twiki/lib/TWiki.pm line 528.
[Sun Mar 7 17:23:53 2004] statistics: Can't create file /home/httpd/twiki/data/Main/WebStatistics.txt - Permission denied
[Sun Mar 7 17:27:37 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Sun Mar 7 17:31:39 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Sun Mar 7 17:58:00 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Sun Mar 7 18:00:09 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Sun Mar 7 18:10:09 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Sun Mar 7 18:19:01 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Sun Mar 7 18:42:29 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Sun Mar 7 18:52:30 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Sun Mar 7 18:58:52 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Sun Mar 7 19:03:58 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Sun Mar 7 19:08:55 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Sun Mar 7 20:04:35 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Sun Mar 7 20:11:33 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Sun Mar 7 20:12:55 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Sun Mar 7 20:25:31 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Sun Mar 7 20:44:48 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Sun Mar 7 20:58:27 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Sun Mar 7 21:16:17 2004] [error] [client xx.xx.xx.xx] File does not exist: /home/httpd/twiki/view/Main/WebHome
[Sun Mar 7 21:20:14 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Sun Mar 7 21:31:12 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Sun Mar 7 21:39:55 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Sun Mar 7 21:44:10 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Mon Mar 8 01:35:13 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Mon Mar 8 01:47:06 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Mon Mar 8 01:59:13 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Mon Mar 8 02:12:24 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Mon Mar 8 02:54:54 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Mon Mar 8 03:46:27 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Mon Mar 8 03:48:18 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Mon Mar 8 03:52:17 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Mon Mar 8 03:55:09 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Mon Mar 8 04:22:55 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Mon Mar 8 04:24:47 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Mon Mar 8 04:40:32 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Mon Mar 8 04:55:40 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Mon Mar 8 04:59:13 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Mon Mar 8 05:22:57 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Mon Mar 8 05:24:29 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
[Mon Mar 8 05:31:47 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
<11>httpd[31628]: [error] [client xx.xx.xx.xx] File does not exist: /usr/local/installed/apache/htdocs/squirrelmail/_vti_inf.html in 29-Mar 15:18:20.50 from xx.xx.xx.xx
<11>httpd[25859]: [error] [client xx.xx.xx.xx] File does not exist: /usr/local/installed/apache/htdocs/squirrelmail/_vti_bin/shtml.exe/_vti_rpc in 29-Mar 15:18:20.54 from xx.xx.xx.xx

File diff suppressed because it is too large Load Diff

@ -0,0 +1,24 @@
<!DOCTYPE HTML>
<!--
Comments are overrated
-->
<html>
<head>
<title>HTML Sample</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<style type="text/css">
h1 {
color: #CCA3A3;
}
body {
}
</style>
<script type="text/javascript">
window.alert("I am a sample...");
</script>
</head>
<body>
<h1>Heading No.1</h1>
<input disabled type="button" value="Click me" />
</body>
</html>

@ -0,0 +1,219 @@
/*
© Microsoft. All rights reserved.
https://microsoft.com
blablahttp://en.wikipedia.org/wiki/Timisoara bla bla
blabla http://en.wikipedia.org/wiki/Timisoara bla bla
This library is supported for use in Windows Tailored Apps only.
Build: 6.2.8100.0
Version: 0.5
*/
'a string\
on multiple lines';
(function (global, undefined) {
"use strict";
undefinedVariable = {}; undefinedVariable.bar = 5;
undefinedVariable.foo = 5; undefinedVariable.baz = 10;
function initializeProperties(target, members) {
var keys = Object.keys(members);
var properties;
var i, len;
for (i = 0, len = keys.length; i < len; i++) {
var key = keys[i];
var enumerable = key.charCodeAt(0) !== /*_*/95;
var member = members[key];
if (member && typeof member === 'object') {
if (member.value !== undefined || typeof member.get === 'function' || typeof member.set === 'function') {
if (member.enumerable === undefined) {
member.enumerable = enumerable;
}
properties = properties || {};
properties[key] = member;
continue;
}
}
if (!enumerable) {
properties = properties || {};
properties[key] = { value: member, enumerable: enumerable, configurable: true, writable: true }
continue;
}
target[key] = member;
}
if (properties) {
Object.defineProperties(target, properties);
}
}
(function (rootNamespace) {
// Create the rootNamespace in the global namespace
if (!global[rootNamespace]) {
global[rootNamespace] = Object.create(Object.prototype);
}
// Cache the rootNamespace we just created in a local variable
var _rootNamespace = global[rootNamespace];
if (!_rootNamespace.Namespace) {
_rootNamespace.Namespace = Object.create(Object.prototype);
}
function defineWithParent(parentNamespace, name, members) {
/// <summary locid="1">
/// Defines a new namespace with the specified name, under the specified parent namespace.
/// </summary>
/// <param name="parentNamespace" type="Object" locid="2">
/// The parent namespace which will contain the new namespace.
/// </param>
/// <param name="name" type="String" locid="3">
/// Name of the new namespace.
/// </param>
/// <param name="members" type="Object" locid="4">
/// Members in the new namespace.
/// </param>
/// <returns locid="5">
/// The newly defined namespace.
/// </returns>
var currentNamespace = parentNamespace,
namespaceFragments = name.split(".");
for (var i = 0, len = namespaceFragments.length; i < len; i++) {
var namespaceName = namespaceFragments[i];
if (!currentNamespace[namespaceName]) {
Object.defineProperty(currentNamespace, namespaceName,
{ value: {}, writable: false, enumerable: true, configurable: true }
);
}
currentNamespace = currentNamespace[namespaceName];
}
if (members) {
initializeProperties(currentNamespace, members);
}
return currentNamespace;
};
function define(name, members) {
/// <summary locid="6">
/// Defines a new namespace with the specified name.
/// </summary>
/// <param name="name" type="String" locid="7">
/// Name of the namespace. This could be a dot-separated nested name.
/// </param>
/// <param name="members" type="Object" locid="4">
/// Members in the new namespace.
/// </param>
/// <returns locid="5">
/// The newly defined namespace.
/// </returns>
return defineWithParent(global, name, members);
}
// Establish members of the "WinJS.Namespace" namespace
Object.defineProperties(_rootNamespace.Namespace, {
defineWithParent: { value: defineWithParent, writable: true, enumerable: true },
define: { value: define, writable: true, enumerable: true }
});
})("WinJS");
(function (WinJS) {
function define(constructor, instanceMembers, staticMembers) {
/// <summary locid="8">
/// Defines a class using the given constructor and with the specified instance members.
/// </summary>
/// <param name="constructor" type="Function" locid="9">
/// A constructor function that will be used to instantiate this class.
/// </param>
/// <param name="instanceMembers" type="Object" locid="10">
/// The set of instance fields, properties and methods to be made available on the class.
/// </param>
/// <param name="staticMembers" type="Object" locid="11">
/// The set of static fields, properties and methods to be made available on the class.
/// </param>
/// <returns type="Function" locid="12">
/// The newly defined class.
/// </returns>
constructor = constructor || function () { };
if (instanceMembers) {
initializeProperties(constructor.prototype, instanceMembers);
}
if (staticMembers) {
initializeProperties(constructor, staticMembers);
}
return constructor;
}
function derive(baseClass, constructor, instanceMembers, staticMembers) {
/// <summary locid="13">
/// Uses prototypal inheritance to create a sub-class based on the supplied baseClass parameter.
/// </summary>
/// <param name="baseClass" type="Function" locid="14">
/// The class to inherit from.
/// </param>
/// <param name="constructor" type="Function" locid="9">
/// A constructor function that will be used to instantiate this class.
/// </param>
/// <param name="instanceMembers" type="Object" locid="10">
/// The set of instance fields, properties and methods to be made available on the class.
/// </param>
/// <param name="staticMembers" type="Object" locid="11">
/// The set of static fields, properties and methods to be made available on the class.
/// </param>
/// <returns type="Function" locid="12">
/// The newly defined class.
/// </returns>
if (baseClass) {
constructor = constructor || function () { };
var basePrototype = baseClass.prototype;
constructor.prototype = Object.create(basePrototype);
Object.defineProperty(constructor.prototype, "_super", { value: basePrototype });
Object.defineProperty(constructor.prototype, "constructor", { value: constructor });
if (instanceMembers) {
initializeProperties(constructor.prototype, instanceMembers);
}
if (staticMembers) {
initializeProperties(constructor, staticMembers);
}
return constructor;
} else {
return define(constructor, instanceMembers, staticMembers);
}
}
function mix(constructor) {
/// <summary locid="15">
/// Defines a class using the given constructor and the union of the set of instance members
/// specified by all the mixin objects. The mixin parameter list can be of variable length.
/// </summary>
/// <param name="constructor" locid="9">
/// A constructor function that will be used to instantiate this class.
/// </param>
/// <returns locid="12">
/// The newly defined class.
/// </returns>
constructor = constructor || function () { };
var i, len;
for (i = 0, len = arguments.length; i < len; i++) {
initializeProperties(constructor.prototype, arguments[i]);
}
return constructor;
}
// Establish members of "WinJS.Class" namespace
WinJS.Namespace.define("WinJS.Class", {
define: define,
derive: derive,
mix: mix
});
})(WinJS);
})(this);

File diff suppressed because one or more lines are too long

@ -0,0 +1,13 @@
rem *******Begin Comment**************
rem This program starts the superapp batch program on the network,
rem directs the output to a file, and displays the file
rem in Notepad.
rem *******End Comment**************
@echo off
if exist C:\output.txt goto EMPTYEXISTS
setlocal
path=g:\programs\superapp;%path%
call superapp>C:\output.txt
endlocal
:EMPTYEXISTS
start notepad c:\output.txt

@ -0,0 +1,246 @@
#include "pch.h"
#include "Direct3DBase.h"
using namespace Microsoft::WRL;
using namespace Windows::UI::Core;
using namespace Windows::Foundation;
// Constructor.
Direct3DBase::Direct3DBase()
{
}
// Initialize the Direct3D resources required to run.
void Direct3DBase::Initialize(CoreWindow^ window)
{
m_window = window;
CreateDeviceResources();
CreateWindowSizeDependentResources();
}
// These are the resources that depend on the device.
void Direct3DBase::CreateDeviceResources()
{
// This flag adds support for surfaces with a different color channel ordering than the API default.
// It is recommended usage, and is required for compatibility with Direct2D.
UINT creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
#if defined(_DEBUG)
// If the project is in a debug build, enable debugging via SDK Layers with this flag.
creationFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif
// This array defines the set of DirectX hardware feature levels this app will support.
// Note the ordering should be preserved.
// Don't forget to declare your application's minimum required feature level in its
// description. All applications are assumed to support 9.1 unless otherwise stated.
D3D_FEATURE_LEVEL featureLevels[] =
{
D3D_FEATURE_LEVEL_11_1,
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_10_0,
D3D_FEATURE_LEVEL_9_3,
D3D_FEATURE_LEVEL_9_2,
D3D_FEATURE_LEVEL_9_1
};
// Create the DX11 API device object, and get a corresponding context.
ComPtr<ID3D11Device> device;
ComPtr<ID3D11DeviceContext> context;
DX::ThrowIfFailed(
D3D11CreateDevice(
nullptr, // specify null to use the default adapter
D3D_DRIVER_TYPE_HARDWARE,
nullptr, // leave as nullptr unless software device
creationFlags, // optionally set debug and Direct2D compatibility flags
featureLevels, // list of feature levels this app can support
ARRAYSIZE(featureLevels), // number of entries in above list
D3D11_SDK_VERSION, // always set this to D3D11_SDK_VERSION
&device, // returns the Direct3D device created
&m_featureLevel, // returns feature level of device created
&context // returns the device immediate context
)
);
// Get the DirectX11.1 device by QI off the DirectX11 one.
DX::ThrowIfFailed(
device.As(&m_d3dDevice)
);
// And get the corresponding device context in the same way.
DX::ThrowIfFailed(
context.As(&m_d3dContext)
);
}
// Allocate all memory resources that change on a window SizeChanged event.
void Direct3DBase::CreateWindowSizeDependentResources()
{
// Store the window bounds so the next time we get a SizeChanged event we can
// avoid rebuilding everything if the size is identical.
m_windowBounds = m_window->Bounds;
// If the swap chain already exists, resize it.
if(m_swapChain != nullptr)
{
DX::ThrowIfFailed(
m_swapChain->ResizeBuffers(2, 0, 0, DXGI_FORMAT_B8G8R8A8_UNORM, 0)
);
}
// Otherwise, create a new one.
else
{
// Create a descriptor for the swap chain.
DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {0};
swapChainDesc.Width = 0; // use automatic sizing
swapChainDesc.Height = 0;
swapChainDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; // this is the most common swapchain format
swapChainDesc.Stereo = false;
swapChainDesc.SampleDesc.Count = 1; // don't use multi-sampling
swapChainDesc.SampleDesc.Quality = 0;
swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapChainDesc.BufferCount = 2; // use two buffers to enable flip effect
swapChainDesc.Scaling = DXGI_SCALING_NONE;
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; // we recommend using this swap effect for all applications
swapChainDesc.Flags = 0;
// Once the desired swap chain description is configured, it must be created on the same adapter as our D3D Device
// First, retrieve the underlying DXGI Device from the D3D Device
ComPtr<IDXGIDevice1> dxgiDevice;
DX::ThrowIfFailed(
m_d3dDevice.As(&dxgiDevice)
);
// Identify the physical adapter (GPU or card) this device is running on.
ComPtr<IDXGIAdapter> dxgiAdapter;
DX::ThrowIfFailed(
dxgiDevice->GetAdapter(&dxgiAdapter)
);
// And obtain the factory object that created it.
ComPtr<IDXGIFactory2> dxgiFactory;
DX::ThrowIfFailed(
dxgiAdapter->GetParent(
__uuidof(IDXGIFactory2),
&dxgiFactory
)
);
Windows::UI::Core::CoreWindow^ p = m_window.Get();
// Create a swap chain for this window from the DXGI factory.
DX::ThrowIfFailed(
dxgiFactory->CreateSwapChainForCoreWindow(
m_d3dDevice.Get(),
reinterpret_cast<IUnknown*>(p),
&swapChainDesc,
nullptr, // allow on all displays
&m_swapChain
)
);
// Ensure that DXGI does not queue more than one frame at a time. This both reduces
// latency and ensures that the application will only render after each VSync, minimizing
// power consumption.
DX::ThrowIfFailed(
dxgiDevice->SetMaximumFrameLatency(1)
);
}
// Obtain the backbuffer for this window which will be the final 3D rendertarget.
ComPtr<ID3D11Texture2D> backBuffer;
DX::ThrowIfFailed(
m_swapChain->GetBuffer(
0,
__uuidof(ID3D11Texture2D),
&backBuffer
)
);
// Create a view interface on the rendertarget to use on bind.
DX::ThrowIfFailed(
m_d3dDevice->CreateRenderTargetView(
backBuffer.Get(),
nullptr,
&m_renderTargetView
)
);
// Cache the rendertarget dimensions in our helper class for convenient use.
D3D11_TEXTURE2D_DESC backBufferDesc;
backBuffer->GetDesc(&backBufferDesc);
m_renderTargetSize.Width = static_cast<float>(backBufferDesc.Width);
m_renderTargetSize.Height = static_cast<float>(backBufferDesc.Height);
// Create a descriptor for the depth/stencil buffer.
CD3D11_TEXTURE2D_DESC depthStencilDesc(
DXGI_FORMAT_D24_UNORM_S8_UINT,
backBufferDesc.Width,
backBufferDesc.Height,
1,
1,
D3D11_BIND_DEPTH_STENCIL);
// Allocate a 2-D surface as the depth/stencil buffer.
ComPtr<ID3D11Texture2D> depthStencil;
DX::ThrowIfFailed(
m_d3dDevice->CreateTexture2D(
&depthStencilDesc,
nullptr,
&depthStencil
)
);
// Create a DepthStencil view on this surface to use on bind.
DX::ThrowIfFailed(
m_d3dDevice->CreateDepthStencilView(
depthStencil.Get(),
&CD3D11_DEPTH_STENCIL_VIEW_DESC(D3D11_DSV_DIMENSION_TEXTURE2D),
&m_depthStencilView
)
);
// Create a viewport descriptor of the full window size.
CD3D11_VIEWPORT viewPort(
0.0f,
0.0f,
static_cast<float>(backBufferDesc.Width),
static_cast<float>(backBufferDesc.Height)
);
// Set the current viewport using the descriptor.
m_d3dContext->RSSetViewports(1, &viewPort);
}
void Direct3DBase::UpdateForWindowSizeChange()
{
if (m_window->Bounds.Width != m_windowBounds.Width ||
m_window->Bounds.Height != m_windowBounds.Height)
{
m_renderTargetView = nullptr;
m_depthStencilView = nullptr;
CreateWindowSizeDependentResources();
}
}
void Direct3DBase::Present()
{
// The first argument instructs DXGI to block until VSync, putting the application
// to sleep until the next VSync. This ensures we don't waste any cycles rendering
// frames that will never be displayed to the screen.
HRESULT hr = m_swapChain->Present(1, 0);
// If the device was removed either by a disconnect or a driver upgrade, we
// must completely reinitialize the renderer.
if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET)
{
Initialize(m_window.Get());
}
else
{
DX::ThrowIfFailed(hr);
}
}

@ -0,0 +1,28 @@
"""
A CoffeeScript sample.
"""
class Vehicle
constructor: (@name) =>
drive: () =>
alert "Conducting #{@name}"
class Car extends Vehicle
drive: () =>
alert "Driving #{@name}"
c = new Car "Brandie"
while notAtDestination()
c.drive()
raceVehicles = (new Car for i in [1..100])
startRace = (vehicles) -> [vehicle.drive() for vehicle in vehicles]
fancyRegExp = ///
(\d+) # numbers
(\w*) # letters
$ # the end
///

@ -0,0 +1,246 @@
#include "pch.h"
#include "Direct3DBase.h"
using namespace Microsoft::WRL;
using namespace Windows::UI::Core;
using namespace Windows::Foundation;
// Constructor.
Direct3DBase::Direct3DBase()
{
}
// Initialize the Direct3D resources required to run.
void Direct3DBase::Initialize(CoreWindow^ window)
{
m_window = window;
CreateDeviceResources();
CreateWindowSizeDependentResources();
}
// These are the resources that depend on the device.
void Direct3DBase::CreateDeviceResources()
{
// This flag adds support for surfaces with a different color channel ordering than the API default.
// It is recommended usage, and is required for compatibility with Direct2D.
UINT creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
#if defined(_DEBUG)
// If the project is in a debug build, enable debugging via SDK Layers with this flag.
creationFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif
// This array defines the set of DirectX hardware feature levels this app will support.
// Note the ordering should be preserved.
// Don't forget to declare your application's minimum required feature level in its
// description. All applications are assumed to support 9.1 unless otherwise stated.
D3D_FEATURE_LEVEL featureLevels[] =
{
D3D_FEATURE_LEVEL_11_1,
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_10_0,
D3D_FEATURE_LEVEL_9_3,
D3D_FEATURE_LEVEL_9_2,
D3D_FEATURE_LEVEL_9_1
};
// Create the DX11 API device object, and get a corresponding context.
ComPtr<ID3D11Device> device;
ComPtr<ID3D11DeviceContext> context;
DX::ThrowIfFailed(
D3D11CreateDevice(
nullptr, // specify null to use the default adapter
D3D_DRIVER_TYPE_HARDWARE,
nullptr, // leave as nullptr unless software device
creationFlags, // optionally set debug and Direct2D compatibility flags
featureLevels, // list of feature levels this app can support
ARRAYSIZE(featureLevels), // number of entries in above list
D3D11_SDK_VERSION, // always set this to D3D11_SDK_VERSION
&device, // returns the Direct3D device created
&m_featureLevel, // returns feature level of device created
&context // returns the device immediate context
)
);
// Get the DirectX11.1 device by QI off the DirectX11 one.
DX::ThrowIfFailed(
device.As(&m_d3dDevice)
);
// And get the corresponding device context in the same way.
DX::ThrowIfFailed(
context.As(&m_d3dContext)
);
}
// Allocate all memory resources that change on a window SizeChanged event.
void Direct3DBase::CreateWindowSizeDependentResources()
{
// Store the window bounds so the next time we get a SizeChanged event we can
// avoid rebuilding everything if the size is identical.
m_windowBounds = m_window->Bounds;
// If the swap chain already exists, resize it.
if(m_swapChain != nullptr)
{
DX::ThrowIfFailed(
m_swapChain->ResizeBuffers(2, 0, 0, DXGI_FORMAT_B8G8R8A8_UNORM, 0)
);
}
// Otherwise, create a new one.
else
{
// Create a descriptor for the swap chain.
DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {0};
swapChainDesc.Width = 0; // use automatic sizing
swapChainDesc.Height = 0;
swapChainDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; // this is the most common swapchain format
swapChainDesc.Stereo = false;
swapChainDesc.SampleDesc.Count = 1; // don't use multi-sampling
swapChainDesc.SampleDesc.Quality = 0;
swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapChainDesc.BufferCount = 2; // use two buffers to enable flip effect
swapChainDesc.Scaling = DXGI_SCALING_NONE;
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; // we recommend using this swap effect for all applications
swapChainDesc.Flags = 0;
// Once the desired swap chain description is configured, it must be created on the same adapter as our D3D Device
// First, retrieve the underlying DXGI Device from the D3D Device
ComPtr<IDXGIDevice1> dxgiDevice;
DX::ThrowIfFailed(
m_d3dDevice.As(&dxgiDevice)
);
// Identify the physical adapter (GPU or card) this device is running on.
ComPtr<IDXGIAdapter> dxgiAdapter;
DX::ThrowIfFailed(
dxgiDevice->GetAdapter(&dxgiAdapter)
);
// And obtain the factory object that created it.
ComPtr<IDXGIFactory2> dxgiFactory;
DX::ThrowIfFailed(
dxgiAdapter->GetParent(
__uuidof(IDXGIFactory2),
&dxgiFactory
)
);
Windows::UI::Core::CoreWindow^ p = m_window.Get();
// Create a swap chain for this window from the DXGI factory.
DX::ThrowIfFailed(
dxgiFactory->CreateSwapChainForCoreWindow(
m_d3dDevice.Get(),
reinterpret_cast<IUnknown*>(p),
&swapChainDesc,
nullptr, // allow on all displays
&m_swapChain
)
);
// Ensure that DXGI does not queue more than one frame at a time. This both reduces
// latency and ensures that the application will only render after each VSync, minimizing
// power consumption.
DX::ThrowIfFailed(
dxgiDevice->SetMaximumFrameLatency(1)
);
}
// Obtain the backbuffer for this window which will be the final 3D rendertarget.
ComPtr<ID3D11Texture2D> backBuffer;
DX::ThrowIfFailed(
m_swapChain->GetBuffer(
0,
__uuidof(ID3D11Texture2D),
&backBuffer
)
);
// Create a view interface on the rendertarget to use on bind.
DX::ThrowIfFailed(
m_d3dDevice->CreateRenderTargetView(
backBuffer.Get(),
nullptr,
&m_renderTargetView
)
);
// Cache the rendertarget dimensions in our helper class for convenient use.
D3D11_TEXTURE2D_DESC backBufferDesc;
backBuffer->GetDesc(&backBufferDesc);
m_renderTargetSize.Width = static_cast<float>(backBufferDesc.Width);
m_renderTargetSize.Height = static_cast<float>(backBufferDesc.Height);
// Create a descriptor for the depth/stencil buffer.
CD3D11_TEXTURE2D_DESC depthStencilDesc(
DXGI_FORMAT_D24_UNORM_S8_UINT,
backBufferDesc.Width,
backBufferDesc.Height,
1,
1,
D3D11_BIND_DEPTH_STENCIL);
// Allocate a 2-D surface as the depth/stencil buffer.
ComPtr<ID3D11Texture2D> depthStencil;
DX::ThrowIfFailed(
m_d3dDevice->CreateTexture2D(
&depthStencilDesc,
nullptr,
&depthStencil
)
);
// Create a DepthStencil view on this surface to use on bind.
DX::ThrowIfFailed(
m_d3dDevice->CreateDepthStencilView(
depthStencil.Get(),
&CD3D11_DEPTH_STENCIL_VIEW_DESC(D3D11_DSV_DIMENSION_TEXTURE2D),
&m_depthStencilView
)
);
// Create a viewport descriptor of the full window size.
CD3D11_VIEWPORT viewPort(
0.0f,
0.0f,
static_cast<float>(backBufferDesc.Width),
static_cast<float>(backBufferDesc.Height)
);
// Set the current viewport using the descriptor.
m_d3dContext->RSSetViewports(1, &viewPort);
}
void Direct3DBase::UpdateForWindowSizeChange()
{
if (m_window->Bounds.Width != m_windowBounds.Width ||
m_window->Bounds.Height != m_windowBounds.Height)
{
m_renderTargetView = nullptr;
m_depthStencilView = nullptr;
CreateWindowSizeDependentResources();
}
}
void Direct3DBase::Present()
{
// The first argument instructs DXGI to block until VSync, putting the application
// to sleep until the next VSync. This ensures we don't waste any cycles rendering
// frames that will never be displayed to the screen.
HRESULT hr = m_swapChain->Present(1, 0);
// If the device was removed either by a disconnect or a driver upgrade, we
// must completely reinitialize the renderer.
if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET)
{
Initialize(m_window.Get());
}
else
{
DX::ThrowIfFailed(hr);
}
}

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VS
{
class Program
{
static void Main(string[] args)
{
ProcessStartInfo si = new ProcessStartInfo();
float load= 3.2e02f;
si.FileName = @"tools\\node.exe";
si.Arguments = "tools\\simpleserver.js";
Process.Start(si);
}
}
}

@ -0,0 +1,828 @@
html {
background-color: #e2e2e2;
margin: 0;
padding: 0;
}
body {
background-color: #fff;
border-top: solid 10px #000;
color: #333;
font-size: .85em;
font-family: "Segoe UI","HelveticaNeue-Light", sans-serif;
margin: 0;
padding: 0;
}
a:link, a:visited,
a:active, a:hover {
color: #333;
outline: none;
padding-left: 0;
padding-right: 3px;
text-decoration: none;
}
a:hover {
background-color: #c7d1d6;
}
header, footer, hgroup
nav, section {
display: block;
}
.float-left {
float: left;
}
.float-right {
float: right;
}
.highlight {
/* background-color: #a6dbed;
padding-left: 5px;
padding-right: 5px;*/
}
.clear-fix:after {
content: ".";
clear: both;
display: block;
height: 0;
visibility: hidden;
}
h1, h2, h3,
h4, h5, h6 {
color: #000;
margin-bottom: 0;
padding-bottom: 0;
}
h1 {
font-size: 2em;
}
h2 {
font-size: 1.75em;
}
h3 {
font-size: 1.2em;
}
h4 {
font-size: 1.1em;
}
h5, h6 {
font-size: 1em;
}
.tile {
/* 2px solid #7ac0da; */
border: 0;
float: left;
width: 200px;
height: 325px;
padding: 5px;
margin-right: 5px;
margin-bottom: 20px;
margin-top: 20px;
-webkit-perspective: 0;
-webkit-transform-style: preserve-3d;
-webkit-transition: -webkit-transform 0.2s;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.3);
background-position: center center;
background-repeat: no-repeat;
background-color: #fff;
}
.tile-item {
/* 2px solid #7ac0da; */
border-color: inherit;
float: left;
width: 50px;
height: 70px;
margin-right: 20px;
margin-bottom: 20px;
margin-top: 20px;
background-image: url('../Images/documents.png');
background-repeat: no-repeat;
}
.tile-wrapper {
width: 100%;
font-family: "Segoe UI" , Tahoma, Geneva, Verdana, sans-serif;
line-height: 21px;
font-size: 14px;
}
a.blue-box {
font-size: 28px;
height: 100px;
display: block;
border-style: solid;
border-width: 1px 1px 4px 1px;
border-color: #C0C0C0 #C0C0C0 #8ABAE4 #C0C0C0;
padding-top: 15px;
padding-left: 15px;
}
a.blue-box:hover {
border: 4px solid #8ABAE4;
padding-top: 12px;
padding-left: 12px;
background-color: #FFFFFF;
}
a.green-box {
font-size: 28px;
height: 100px;
display: block;
border-style: solid;
border-width: 1px 1px 4px 1px;
border-color: #C0C0C0 #C0C0C0 #9CCF42 #C0C0C0;
padding-top: 15px;
padding-left: 15px;
}
a.green-box:hover {
border: 4px solid #9CCF42;
padding-top: 12px;
padding-left: 12px;
background-color: #FFFFFF;
}
a.green-box2 {
font-size: 14px;
height: 48px;
width: 48px;
display: block; /* border-color: #C0C0C0; */
padding-top: 6px;
font-weight: bold;
}
a.green-box2:hover {
border: solid #8ABAE4;
padding-top: 0px;
padding-left: 0px;
background-image: url('../Images/documents.png');
background-color: #EFEFEF;
}
a.yellow-box {
font-size: 28px;
height: 100px;
display: block;
border-style: solid;
border-width: 1px 1px 4px 1px;
border-color: #C0C0C0 #C0C0C0 #DECF6B #C0C0C0;
padding-top: 15px;
padding-left: 15px;
}
a.yellow-box:hover {
border: 4px solid #DECF6B;
padding-top: 12px;
padding-left: 12px;
background-color: #FFFFFF;
}
a.red-box {
font-size: 28px;
height: 100px;
display: block;
border-style: solid;
border-width: 1px 1px 4px 1px;
border-color: #C0C0C0 #C0C0C0 #F79E84 #C0C0C0;
padding-top: 15px;
padding-left: 15px;
}
a.red-box:hover {
border: 4px solid #F79E84;
padding-top: 12px;
padding-left: 12px;
background-color: #FFFFFF;
}
/* main layout
----------------------------------------------------------*/
.content-wrapper {
margin: 0 auto;
max-width: 960px;
}
#body {
background-color: #efeeef;
clear: both;
padding-bottom: 35px;
}
.main-content {
background: url("../images/accent.png") no-repeat;
padding-left: 10px;
padding-top: 30px;
}
.featured + .main-content {
background: url("../images/heroaccent.png") no-repeat;
}
footer {
clear: both;
background-color: #e2e2e2;
font-size: .8em;
height: 100px;
}
/* site title
----------------------------------------------------------*/
.site-title {
color: #0066CC; /* font-family: Rockwell, Consolas, "Courier New", Courier, monospace; */
font-size: 3.3em;
margin-top: 40px;
margin-bottom: 0;
}
.site-title a, .site-title a:hover, .site-title a:active {
background: none;
color: #0066CC;
outline: none;
text-decoration: none;
}
/* login
----------------------------------------------------------*/
#login {
display: block;
font-size: .85em;
margin-top: 20px;
text-align: right;
}
#login a {
background-color: #d3dce0;
margin-left: 10px;
margin-right: 3px;
padding: 2px 3px;
text-decoration: none;
}
#login a.username {
background: none;
margin-left: 0px;
text-decoration: underline;
}
#login li {
display: inline;
list-style: none;
}
/* menu
----------------------------------------------------------*/
ul#menu {
font-size: 1.3em;
font-weight: 600;
margin: 0;
text-align: right;
text-decoration: none;
}
ul#menu li {
display: inline;
list-style: none;
padding-left: 15px;
}
ul#menu li a {
background: none;
color: #999;
text-decoration: none;
}
ul#menu li a:hover {
color: #333;
text-decoration: none;
}
/* page elements
----------------------------------------------------------*/
/* featured */
.featured {
background-color: #fff;
}
.featured .content-wrapper {
/*background-color: #7ac0da;
background-image: -ms-linear-gradient(left, #7AC0DA 0%, #A4D4E6 100%);
background-image: -o-linear-gradient(left, #7AC0DA 0%, #A4D4E6 100%);
background-image: -webkit-gradient(linear, left top, right top, color-stop(0, #7AC0DA), color-stop(1, #A4D4E6));
background-image: -webkit-linear-gradient(left, #7AC0DA 0%, #A4D4E6 100%);
background-image: linear-gradient(left, #7AC0DA 0%, #A4D4E6 100%);
color: #3e5667;
*/
padding: 0px 40px 30px 40px;
}
.featured hgroup.title h1, .featured hgroup.title h2 {
/* color: #fff;
*/
}
.featured p {
font-size: 1.1em;
}
/* page titles */
hgroup.title {
margin-bottom: 10px;
}
hgroup.title h1, hgroup.title h2 {
display: inline;
}
hgroup.title h2 {
font-weight: normal;
}
/* releases */
.milestone {
color: #fff;
background-color: #8ABAE4;
font-weight: normal;
padding: 10px 10px 10px 10px;
margin: 0 0 0 0;
}
.milestone .primary {
font-size: 1.75em;
}
.milestone .secondary {
font-size: 1.2em;
font-weight: normal;
/* padding: 5px 5px 5px 10px;*/
}
/* features */
section.feature {
width: 200px;
float: left;
padding: 10px;
}
/* ordered list */
ol.round {
list-style-type: none;
padding-left: 0;
}
ol.round li {
margin: 25px 0;
padding-left: 45px;
}
ol.round li.one {
background: url("../images/orderedlistOne.png") no-repeat;
}
ol.round li.two {
background: url("../images/orderedlistTwo.png") no-repeat;
}
ol.round li.three {
background: url("../images/orderedlistThree.png") no-repeat;
}
/* content */
article {
float: left;
width: 70%;
}
aside {
float: right;
width: 25%;
}
aside ul {
list-style: none;
padding: 0;
}
aside ul li {
background: url("../images/bullet.png") no-repeat 0 50%;
padding: 2px 0 2px 20px;
}
.label {
font-weight: 700;
}
/* login page */
#loginForm {
border-right: solid 2px #c8c8c8;
float: left;
width: 45%;
}
#loginForm .validation-error {
display: block;
margin-left: 15px;
}
#socialLoginForm {
margin-left: 40px;
float: left;
width: 50%;
}
/* contact */
.contact h3 {
font-size: 1.2em;
}
.contact p {
margin: 5px 0 0 10px;
}
.contact iframe {
border: solid 1px #333;
margin: 5px 0 0 10px;
}
/* forms */
fieldset {
border: none;
margin: 0;
padding: 0;
}
fieldset legend {
display: none;
}
fieldset ol {
padding: 0;
list-style: none;
}
fieldset ol li {
padding-bottom: 5px;
}
fieldset label {
display: block;
font-size: 1.2em;
font-weight: 600;
}
fieldset label.checkbox {
display: inline;
}
fieldset input[type="text"],
fieldset input[type="password"] {
border: 1px solid #e2e2e2;
color: #333;
font-size: 1.2em;
margin: 5px 0 6px 0;
padding: 5px;
width: 300px;
}
fieldset input[type="text"]:focus,
fieldset input[type="password"]:focus {
border: 1px solid #7ac0da;
}
fieldset input[type="submit"] {
background-color: #d3dce0;
border: solid 1px #787878;
cursor: pointer;
font-size: 1.2em;
font-weight: 600;
padding: 7px;
}
/* ajax login/registration dialog */
.modal-popup {
font-size: 0.7em;
}
/* info and errors */
.message-info {
border: solid 1px;
clear: both;
padding: 10px 20px;
}
.message-error {
clear: both;
color: #e80c4d;
font-size: 1.1em;
font-weight: bold;
margin: 20px 0 10px 0;
}
.message-success {
color: #7ac0da;
font-size: 1.3em;
font-weight: bold;
margin: 20px 0 10px 0;
}
.success {
color: #7ac0da;
}
.error {
color: #e80c4d;
}
/* styles for validation helpers */
.field-validation-error {
color: #e80c4d;
font-weight: bold;
}
.field-validation-valid {
display: none;
}
input[type="text"].input-validation-error,
input[type="password"].input-validation-error {
border: solid 1px #e80c4d;
}
.validation-summary-errors {
color: #e80c4d;
font-weight: bold;
font-size: 1.1em;
}
.validation-summary-valid {
display: none;
}
/* social */
ul#social li {
display: inline;
list-style: none;
}
ul#social li a {
color: #999;
text-decoration: none;
}
a.facebook, a.twitter {
display: block;
float: left;
height: 24px;
padding-left: 17px;
text-indent: -9999px;
width: 16px;
}
a.facebook {
background: url("../images/facebook.png") no-repeat;
}
a.twitter {
background: url("../images/twitter.png") no-repeat;
}
/********************
* Mobile Styles *
********************/
@media only screen and (max-width: 850px) {
/* header
----------------------------------------------------------*/
header .float-left,
header .float-right {
float: none;
}
/* logo */
header .site-title {
/*margin: 0; */
/*margin: 10px;*/
text-align: left;
padding-left: 0;
}
/* login */
#login {
font-size: .85em;
margin-top: 0;
text-align: center;
}
#login ul {
margin: 5px 0;
padding: 0;
}
#login li {
display: inline;
list-style: none;
margin: 0;
padding:0;
}
#login a {
background: none;
color: #999;
font-weight: 600;
margin: 2px;
padding: 0;
}
#login a:hover {
color: #333;
}
/* menu */
nav {
margin-bottom: 5px;
}
ul#menu {
margin: 0;
padding:0;
text-align: center;
}
ul#menu li {
margin: 0;
padding: 0;
}
/* main layout
----------------------------------------------------------*/
.main-content,
.featured + .main-content {
background-position: 10px 0;
}
.content-wrapper {
padding-right: 10px;
padding-left: 10px;
}
.featured .content-wrapper {
padding: 10px;
}
/* page content */
article, aside {
float: none;
width: 100%;
}
/* ordered list */
ol.round {
list-style-type: none;
padding-left: 0;
}
ol.round li {
padding-left: 10px;
margin: 25px 0;
}
ol.round li.one,
ol.round li.two,
ol.round li.three {
background: none;
}
/* features */
section.feature {
float: none;
padding: 10px;
width: auto;
}
section.feature img {
color: #999;
content: attr(alt);
font-size: 1.5em;
font-weight: 600;
}
/* forms */
fieldset input[type="text"],
fieldset input[type="password"] {
width: 90%;
}
/* login page */
#loginForm {
border-right: none;
float: none;
width: auto;
}
#loginForm .validation-error {
display: block;
margin-left: 15px;
}
#socialLoginForm {
margin-left: 0;
float: none;
width: auto;
}
/* footer
----------------------------------------------------------*/
footer .float-left,
footer .float-right {
float: none;
}
footer {
text-align: center;
height: auto;
padding: 10px 0;
}
footer p {
margin: 0;
}
ul#social {
padding:0;
margin: 0;
}
a.facebook, a.twitter {
background: none;
display: inline;
float: none;
height: auto;
padding-left: 0;
text-indent: 0;
width: auto;
}
}
.subsite {
color: #444;
}
h3 {
font-weight: normal;
font-size: 24px;
color: #444;
margin-bottom: 20px;
}
.tiles {
padding-bottom: 20px;
background-color: #e3e3e3;
}
#editor {
margin: 0 auto;
height: 500px;
border: 1px solid #ccc;
}
.monaco-editor.monaco, .monaco-editor.vs, .monaco-editor.eclipse {
background: #F9F9F9;
}
.monaco-editor.monaco .monaco-editor-background, .monaco-editor.vs .monaco-editor-background, .monaco-editor.eclipse .monaco-editor-background {
background: #F9F9F9;
}

@ -0,0 +1,32 @@
FROM mono:3.12
ENV KRE_FEED https://www.myget.org/F/aspnetvnext/api/v2
ENV KRE_USER_HOME /opt/kre
RUN apt-get -qq update && apt-get -qqy install unzip
ONBUILD RUN curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/kvminstall.sh | sh
ONBUILD RUN bash -c "source $KRE_USER_HOME/kvm/kvm.sh \
&& kvm install latest -a default \
&& kvm alias default | xargs -i ln -s $KRE_USER_HOME/packages/{} $KRE_USER_HOME/packages/default"
# Install libuv for Kestrel from source code (binary is not in wheezy and one in jessie is still too old)
RUN apt-get -qqy install \
autoconf \
automake \
build-essential \
libtool
RUN LIBUV_VERSION=1.0.0-rc2 \
&& curl -sSL https://github.com/joyent/libuv/archive/v${LIBUV_VERSION}.tar.gz | tar zxfv - -C /usr/local/src \
&& cd /usr/local/src/libuv-$LIBUV_VERSION \
&& sh autogen.sh && ./configure && make && make install \
&& rm -rf /usr/local/src/libuv-$LIBUV_VERSION \
&& ldconfig
ENV PATH $PATH:$KRE_USER_HOME/packages/default/bin
# Extra things to test
RUN echo "string at end"
RUN echo must work 'some str' and some more
RUN echo hi this is # not a comment
RUN echo 'String with ${VAR} and another $one here'

@ -0,0 +1,8 @@
(* Sample F# application *)
[<EntryPoint>]
let main argv =
printfn "%A" argv
System.Console.WriteLine("Hello from F#")
0 // return an integer exit code
//--------------------------------------------------------

@ -0,0 +1,111 @@
// We often need our programs to perform operations on
// collections of data, like selecting all items that
// satisfy a given predicate or mapping all items to a new
// collection with a custom function.
// In some languages it's idiomatic to use [generic](http://en.wikipedia.org/wiki/Generic_programming)
// data structures and algorithms. Go does not support
// generics; in Go it's common to provide collection
// functions if and when they are specifically needed for
// your program and data types.
// Here are some example collection functions for slices
// of `strings`. You can use these examples to build your
// own functions. Note that in some cases it may be
// clearest to just inline the collection-manipulating
// code directly, instead of creating and calling a
// helper function.
package main
import "strings"
import "fmt"
// Returns the first index of the target string `t`, or
// -1 if no match is found.
func Index(vs []string, t string) int {
for i, v := range vs {
if v == t {
return i
}
}
return -1
}
// Returns `true` if the target string t is in the
// slice.
func Include(vs []string, t string) bool {
return Index(vs, t) >= 0
}
// Returns `true` if one of the strings in the slice
// satisfies the predicate `f`.
func Any(vs []string, f func(string) bool) bool {
for _, v := range vs {
if f(v) {
return true
}
}
return false
}
// Returns `true` if all of the strings in the slice
// satisfy the predicate `f`.
func All(vs []string, f func(string) bool) bool {
for _, v := range vs {
if !f(v) {
return false
}
}
return true
}
// Returns a new slice containing all strings in the
// slice that satisfy the predicate `f`.
func Filter(vs []string, f func(string) bool) []string {
vsf := make([]string, 0)
for _, v := range vs {
if f(v) {
vsf = append(vsf, v)
}
}
return vsf
}
// Returns a new slice containing the results of applying
// the function `f` to each string in the original slice.
func Map(vs []string, f func(string) string) []string {
vsm := make([]string, len(vs))
for i, v := range vs {
vsm[i] = f(v)
}
return vsm
}
func main() {
// Here we try out our various collection functions.
var strs = []string{"peach", "apple", "pear", "plum"}
fmt.Println(Index(strs, "pear"))
fmt.Println(Include(strs, "grape"))
fmt.Println(Any(strs, func(v string) bool {
return strings.HasPrefix(v, "p")
}))
fmt.Println(All(strs, func(v string) bool {
return strings.HasPrefix(v, "p")
}))
fmt.Println(Filter(strs, func(v string) bool {
return strings.Contains(v, "e")
}))
// The above examples all used anonymous functions,
// but you can also use named functions of the correct
// type.
fmt.Println(Map(strs, strings.ToUpper))
}

@ -0,0 +1,31 @@
<div class="entry">
<h1>{{title}}</h1>
{{#if author}}
<h2>{{author.firstName}} {{author.lastName}}</h2>
{{else}}
<h2>Unknown Author</h2>
{{/if}}
{{contentBody}}
</div>
{{#unless license}}
<h3 class="warning">WARNING: This entry does not have a license!</h3>
{{/unless}}
<div class="footnotes">
<ul>
{{#each footnotes}}
<li>{{this}}</li>
{{/each}}
</ul>
</div>
<h1>Comments</h1>
<div id="comments">
{{#each comments}}
<h2><a href="/posts/{{../permalink}}#{{id}}">{{title}}</a></h2>
<div>{{body}}</div>
{{/each}}
</div>

@ -0,0 +1,22 @@
<!DOCTYPE HTML>
<!--
Comments are overrated
-->
<html>
<head>
<title>HTML Sample</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<style type="text/css">
h1 {
color: #CCA3A3;
}
</style>
<script type="text/javascript">
window.alert("I am a sample...");
</script>
</head>
<body>
<h1>Heading No.1</h1>
<input disabled type="button" value="Click me" />
</body>
</html>

@ -0,0 +1,15 @@
# Example of a .gitconfig file
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
# Defines the master branch
[branch "master"]
remote = origin
merge = refs/heads/master

@ -0,0 +1,18 @@
doctype 5
html(lang="en")
head
title= pageTitle
script(type='text/javascript')
if (foo) {
bar()
}
body
// Disclaimer: You will need to turn insertSpaces to true in order for the
syntax highlighting to kick in properly (especially for comments)
Enjoy :)
h1 Jade - node template engine
#container
if youAreUsingJade
p You are amazing
else
p Get on it!

@ -0,0 +1,14 @@
import java.util.ArrayList;
import org.junit.Test;
public class Example {
@Test
public void method() {
org.junit.Assert.assertTrue( "isEmpty", new ArrayList<Integer>().isEmpty());
}
@Test(timeout=100) public void infinity() {
while(true);
}
}

@ -0,0 +1,214 @@
/*
© Microsoft. All rights reserved.
This library is supported for use in Windows Tailored Apps only.
Build: 6.2.8100.0
Version: 0.5
*/
(function (global, undefined) {
"use strict";
undefinedVariable = {};
undefinedVariable.prop = 5;
function initializeProperties(target, members) {
var keys = Object.keys(members);
var properties;
var i, len;
for (i = 0, len = keys.length; i < len; i++) {
var key = keys[i];
var enumerable = key.charCodeAt(0) !== /*_*/95;
var member = members[key];
if (member && typeof member === 'object') {
if (member.value !== undefined || typeof member.get === 'function' || typeof member.set === 'function') {
if (member.enumerable === undefined) {
member.enumerable = enumerable;
}
properties = properties || {};
properties[key] = member;
continue;
}
}
if (!enumerable) {
properties = properties || {};
properties[key] = { value: member, enumerable: enumerable, configurable: true, writable: true }
continue;
}
target[key] = member;
}
if (properties) {
Object.defineProperties(target, properties);
}
}
(function (rootNamespace) {
// Create the rootNamespace in the global namespace
if (!global[rootNamespace]) {
global[rootNamespace] = Object.create(Object.prototype);
}
// Cache the rootNamespace we just created in a local variable
var _rootNamespace = global[rootNamespace];
if (!_rootNamespace.Namespace) {
_rootNamespace.Namespace = Object.create(Object.prototype);
}
function defineWithParent(parentNamespace, name, members) {
/// <summary locid="1">
/// Defines a new namespace with the specified name, under the specified parent namespace.
/// </summary>
/// <param name="parentNamespace" type="Object" locid="2">
/// The parent namespace which will contain the new namespace.
/// </param>
/// <param name="name" type="String" locid="3">
/// Name of the new namespace.
/// </param>
/// <param name="members" type="Object" locid="4">
/// Members in the new namespace.
/// </param>
/// <returns locid="5">
/// The newly defined namespace.
/// </returns>
var currentNamespace = parentNamespace,
namespaceFragments = name.split(".");
for (var i = 0, len = namespaceFragments.length; i < len; i++) {
var namespaceName = namespaceFragments[i];
if (!currentNamespace[namespaceName]) {
Object.defineProperty(currentNamespace, namespaceName,
{ value: {}, writable: false, enumerable: true, configurable: true }
);
}
currentNamespace = currentNamespace[namespaceName];
}
if (members) {
initializeProperties(currentNamespace, members);
}
return currentNamespace;
}
function define(name, members) {
/// <summary locid="6">
/// Defines a new namespace with the specified name.
/// </summary>
/// <param name="name" type="String" locid="7">
/// Name of the namespace. This could be a dot-separated nested name.
/// </param>
/// <param name="members" type="Object" locid="4">
/// Members in the new namespace.
/// </param>
/// <returns locid="5">
/// The newly defined namespace.
/// </returns>
return defineWithParent(global, name, members);
}
// Establish members of the "WinJS.Namespace" namespace
Object.defineProperties(_rootNamespace.Namespace, {
defineWithParent: { value: defineWithParent, writable: true, enumerable: true },
define: { value: define, writable: true, enumerable: true }
});
})("WinJS");
(function (WinJS) {
function define(constructor, instanceMembers, staticMembers) {
/// <summary locid="8">
/// Defines a class using the given constructor and with the specified instance members.
/// </summary>
/// <param name="constructor" type="Function" locid="9">
/// A constructor function that will be used to instantiate this class.
/// </param>
/// <param name="instanceMembers" type="Object" locid="10">
/// The set of instance fields, properties and methods to be made available on the class.
/// </param>
/// <param name="staticMembers" type="Object" locid="11">
/// The set of static fields, properties and methods to be made available on the class.
/// </param>
/// <returns type="Function" locid="12">
/// The newly defined class.
/// </returns>
constructor = constructor || function () { };
if (instanceMembers) {
initializeProperties(constructor.prototype, instanceMembers);
}
if (staticMembers) {
initializeProperties(constructor, staticMembers);
}
return constructor;
}
function derive(baseClass, constructor, instanceMembers, staticMembers) {
/// <summary locid="13">
/// Uses prototypal inheritance to create a sub-class based on the supplied baseClass parameter.
/// </summary>
/// <param name="baseClass" type="Function" locid="14">
/// The class to inherit from.
/// </param>
/// <param name="constructor" type="Function" locid="9">
/// A constructor function that will be used to instantiate this class.
/// </param>
/// <param name="instanceMembers" type="Object" locid="10">
/// The set of instance fields, properties and methods to be made available on the class.
/// </param>
/// <param name="staticMembers" type="Object" locid="11">
/// The set of static fields, properties and methods to be made available on the class.
/// </param>
/// <returns type="Function" locid="12">
/// The newly defined class.
/// </returns>
if (baseClass) {
constructor = constructor || function () { };
var basePrototype = baseClass.prototype;
constructor.prototype = Object.create(basePrototype);
Object.defineProperty(constructor.prototype, "_super", { value: basePrototype });
Object.defineProperty(constructor.prototype, "constructor", { value: constructor });
if (instanceMembers) {
initializeProperties(constructor.prototype, instanceMembers);
}
if (staticMembers) {
initializeProperties(constructor, staticMembers);
}
return constructor;
} else {
return define(constructor, instanceMembers, staticMembers);
}
}
function mix(constructor) {
/// <summary locid="15">
/// Defines a class using the given constructor and the union of the set of instance members
/// specified by all the mixin objects. The mixin parameter list can be of variable length.
/// </summary>
/// <param name="constructor" locid="9">
/// A constructor function that will be used to instantiate this class.
/// </param>
/// <returns locid="12">
/// The newly defined class.
/// </returns>
constructor = constructor || function () { };
var i, len;
for (i = 0, len = arguments.length; i < len; i++) {
initializeProperties(constructor.prototype, arguments[i]);
}
return constructor;
}
// Establish members of "WinJS.Class" namespace
WinJS.Namespace.define("WinJS.Class", {
define: define,
derive: derive,
mix: mix
});
})(WinJS);
})(this);

@ -0,0 +1,68 @@
{
"type": "team",
"test": {
"testPage": "tools/testing/run-tests.htm",
"enabled": true
},
"search": {
"excludeFolders": [
".git",
"node_modules",
"tools/bin",
"tools/counts",
"tools/policheck",
"tools/tfs_build_extensions",
"tools/testing/jscoverage",
"tools/testing/qunit",
"tools/testing/chutzpah",
"server.net"
]
},
"languages": {
"vs.languages.typescript": {
"validationSettings": [{
"scope":"/",
"noImplicitAny":true,
"noLib":false,
"extraLibs":[],
"semanticValidation":true,
"syntaxValidation":true,
"codeGenTarget":"ES5",
"moduleGenTarget":"",
"lint": {
"emptyBlocksWithoutComment": "warning",
"curlyBracketsMustNotBeOmitted": "warning",
"comparisonOperatorsNotStrict": "warning",
"missingSemicolon": "warning",
"unknownTypeOfResults": "warning",
"semicolonsInsteadOfBlocks": "warning",
"functionsInsideLoops": "warning",
"functionsWithoutReturnType": "warning",
"tripleSlashReferenceAlike": "warning",
"unusedImports": "warning",
"unusedVariables": "warning",
"unusedFunctions": "warning",
"unusedMembers": "warning"
}
},
{
"scope":"/client",
"baseUrl":"/client",
"moduleGenTarget":"amd"
},
{
"scope":"/server",
"moduleGenTarget":"commonjs"
},
{
"scope":"/build",
"moduleGenTarget":"commonjs"
},
{
"scope":"/node_modules/nake",
"moduleGenTarget":"commonjs"
}],
"allowMultipleWorkers": true
}
}
}

@ -0,0 +1,46 @@
@base: #f938ab;
.box-shadow(@style, @c) when (iscolor(@c)) {
border-radius: @style @c;
}
.box-shadow(@style, @alpha: 50%) when (isnumber(@alpha)) {
.box-shadow(@style, rgba(0, 0, 0, @alpha));
}
.box {
color: saturate(@base, 5%);
border-color: lighten(@base, 30%);
div {
.box-shadow((0 0 5px), 30%);
}
}
#header {
h1 {
font-size: 26px;
font-weight: bold;
}
p { font-size: 12px;
a { text-decoration: none;
&:hover { border-width: 1px }
}
}
}
@the-border: 1px;
@base-color: #111;
@red: #842210;
#header {
color: (@base-color * 3);
border-left: @the-border;
border-right: (@the-border * 2);
}
#footer {
color: (@base-color + #003300);
border-color: desaturate(@red, 10%);
}

@ -0,0 +1,12 @@
-- defines a factorial function
function fact (n)
if n == 0 then
return 1
else
return n * fact(n-1)
end
end
print("enter a number:")
a = io.read("*number") -- read a number
print(fact(a))

@ -0,0 +1,97 @@
# Header 1 #
## Header 2 ##
### Header 3 ### (Hashes on right are optional)
## Markdown plus h2 with a custom ID ## {#id-goes-here}
[Link back to H2](#id-goes-here)
<!-- html madness -->
<div class="custom-class" markdown="1">
<div>
nested div
</div>
<script type='text/x-koka'>
function( x: int ) { return x*x; }
</script>
This is a div _with_ underscores
and a & <b class="bold">bold</b> element.
<style>
body { font: "Consolas" }
</style>
</div>
* Bullet lists are easy too
- Another one
+ Another one
This is a paragraph, which is text surrounded by
whitespace. Paragraphs can be on one
line (or many), and can drone on for hours.
Now some inline markup like _italics_, **bold**,
and `code()`. Note that underscores
in_words_are ignored.
````application/json
{ value: ["or with a mime type"] }
````
> Blockquotes are like quoted text in email replies
>> And, they can be nested
1. A numbered list
2. Which is numbered
3. With periods and a space
And now some code:
// Code is just text indented a bit
which(is_easy) to_remember();
And a block
~~~
// Markdown extra adds un-indented code blocks too
if (this_is_more_code == true && !indented) {
// tild wrapped code blocks, also not indented
}
~~~
Text with
two trailing spaces
(on the right)
can be used
for things like poems
### Horizontal rules
* * * *
****
--------------------------
![picture alt](/images/photo.jpeg "Title is optional")
## Markdown plus tables ##
| Header | Header | Right |
| ------ | ------ | -----: |
| Cell | Cell | $10 |
| Cell | Cell | $20 |
* Outer pipes on tables are optional
* Colon used for alignment (right versus left)
## Markdown plus definition lists ##
Bottled water
: $ 1.25
: $ 1.55 (Large)
Milk
Pop
: $ 1.75
* Multiple definitions and terms are possible
* Definitions can include multiple paragraphs too
*[ABBR]: Markdown plus abbreviations (produces an <abbr> tag)

@ -0,0 +1,52 @@
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
#import "UseQuotes.h"
#import <Use/GTLT.h>
/*
Multi
Line
Comments
*/
@implementation Test
- (void) applicationWillFinishLaunching:(NSNotification *)notification
{
}
- (IBAction)onSelectInput:(id)sender
{
NSString* defaultDir = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, true)[0];
NSOpenPanel* panel = [NSOpenPanel openPanel];
[panel setAllowedFileTypes:[[NSArray alloc] initWithObjects:@"ipa", @"xcarchive", @"app", nil]];
[panel beginWithCompletionHandler:^(NSInteger result)
{
if (result == NSFileHandlingPanelOKButton)
[self.inputTextField setStringValue:[panel.URL path]];
}];
return YES;
int hex = 0xFEF1F0F;
float ing = 3.14;
ing = 3.14e0;
ing = 31.4e-2;
}
-(id) initWithParams:(id<anObject>) aHandler withDeviceStateManager:(id<anotherObject>) deviceStateManager
{
// add a tap gesture recognizer
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
NSMutableArray *gestureRecognizers = [NSMutableArray array];
[gestureRecognizers addObject:tapGesture];
[gestureRecognizers addObjectsFromArray:scnView.gestureRecognizers];
scnView.gestureRecognizers = gestureRecognizers;
return tapGesture;
return nil;
}
@end

@ -0,0 +1,82 @@
<?php
// The next line contains a syntax error:
if () {
return "The parser recovers from this type of syntax error";
}
?>
<html>
<head>
<title>Example page</title>
</head>
<body>
<script type="text/javascript">
// Some PHP embedded inside JS
// Generated <?=date('l, F jS, Y')?>
var server_token = <?=rand(5, 10000)?>
if (typeof server_token === 'number') {
alert('token: ' + server_token);
}
</script>
<div>
Hello
<? if (isset($user)) { ?>
<b><?=$user?></b>
<? } else { ?>
<i>guest</i>
<? } ?>
!
</div>
<?php
/* Example PHP file
multiline comment
*/
$cards = array("ah", "ac", "ad", "as",
"2h", "2c", "2d", "2s",
"3h", "3c", "3d", "3s",
"4h", "4c", "4d", "4s",
"5h", "5c", "5d", "5s",
"6h", "6c", "6d", "6s",
"7h", "7c", "7d", "7s",
"8h", "8c", "8d", "8s",
"9h", "9c", "9d", "9s",
"th", "tc", "td", "ts",
"jh", "jc", "jd", "js",
"qh", "qc", "qd", "qs",
"kh", "kc", "kd", "ks");
srand(time());
for($i = 0; $i < 52; $i++) {
$count = count($cards);
$random = (rand()%$count);
if($cards[$random] == "") {
$i--;
} else {
$deck[] = $cards[$random];
$cards[$random] = "";
}
}
srand(time());
$starting_point = (rand()%51);
print("Starting point for cut cards is: $starting_point<p>");
// display shuffled cards (EXAMPLE ONLY)
for ($index = 0; $index < 52; $index++) {
if ($starting_point == 52) { $starting_point = 0; }
print("Uncut Point: <strong>$deck[$index]</strong> ");
print("Starting Point: <strong>$deck[$starting_point]</strong><br>");
$starting_point++;
}
?>
</body>
</html>

@ -0,0 +1,9 @@
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec cursus aliquet sapien, sed rhoncus leo ullamcorper ornare. Interdum et malesuada fames ac ante ipsum primis in faucibus. Phasellus feugiat eleifend nisl, aliquet rhoncus quam scelerisque vel. Morbi eu pellentesque ex. Nam suscipit maximus leo blandit cursus. Aenean sollicitudin nisi luctus, ornare nibh viverra, laoreet ex. Donec eget nibh sit amet dolor ornare elementum. Morbi sollicitudin enim vitae risus pretium vestibulum. Ut pretium hendrerit libero, non vulputate ante volutpat et. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nullam malesuada turpis vitae est porttitor, id tincidunt neque dignissim. Integer rhoncus vestibulum justo in iaculis. Praesent nec augue ut dui scelerisque gravida vel id velit. Donec vehicula feugiat mollis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Praesent diam lorem, luctus quis ullamcorper non, consequat quis orci. Ut vel massa vel nunc sagittis porttitor a vitae ante. Quisque euismod lobortis imperdiet. Vestibulum tincidunt vehicula posuere. Nulla facilisi. Donec sodales imperdiet risus id ullamcorper. Nulla luctus orci tortor, vitae tincidunt urna aliquet nec. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Etiam consequat dapibus massa. Sed ac pharetra magna, in imperdiet neque. Nullam nunc nisi, consequat vel nunc et, sagittis aliquam arcu. Aliquam non orci magna. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed id sem ut sem pulvinar rhoncus. Aenean venenatis nunc eget mi ornare, vitae maximus lacus varius. Quisque quis vestibulum justo.
Donec euismod luctus volutpat. Donec sed lacinia enim. Vivamus aliquam elit cursus, convallis diam at, volutpat turpis. Sed lacinia nisl in auctor dapibus. Nunc turpis mi, mattis ut rhoncus id, lacinia sed lectus. Donec sodales tellus quis libero gravida pretium et quis magna. Etiam ultricies mollis purus, eget consequat velit. Duis vitae nibh vitae arcu tincidunt congue. Maecenas ut velit in ipsum condimentum dictum quis eget urna. Sed mattis nulla arcu, vitae mattis ligula dictum at.
Praesent at dignissim dolor. Donec quis placerat sem. Cras vitae placerat sapien, eu sagittis ex. Mauris nec luctus risus. Cras imperdiet semper neque suscipit auctor. Mauris nisl massa, commodo sit amet dignissim id, malesuada sed ante. Praesent varius sapien eget eros vehicula porttitor.
Mauris auctor nunc in quam tempor, eget consectetur nisi rhoncus. Donec et nulla imperdiet, gravida dui at, accumsan velit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Proin sollicitudin condimentum auctor. Sed lacinia eleifend nisi, id scelerisque leo laoreet sit amet. Morbi congue augue a malesuada pulvinar. Curabitur nec ante finibus, commodo orci vel, aliquam libero. Morbi molestie purus non nunc placerat fermentum. Pellentesque commodo ligula sed pretium aliquam. Praesent ut nibh ex. Vivamus vestibulum velit in leo suscipit, vitae pellentesque urna vulputate. Suspendisse pretium placerat ligula eu ullamcorper. Nam eleifend mi tellus, ut tristique ante ultricies vitae. Quisque venenatis dapibus tellus sit amet mattis. Donec erat arcu, elementum vel nisl at, sagittis vulputate nisi.

@ -0,0 +1,30 @@
$SelectedObjectNames=@();
$XenCenterNodeSelected = 0;
#the object info array contains hashmaps, each of which represent a parameter set and describe a target in the XenCenter resource list
foreach($parameterSet in $ObjInfoArray)
{
if ($parameterSet["class"] -eq "blank")
{
#When the XenCenter node is selected a parameter set is created for each of your connected servers with the class and objUuid keys marked as blank
if ($XenCenterNodeSelected)
{
continue
}
$XenCenterNodeSelected = 1;
$SelectedObjectNames += "XenCenter"
}
elseif ($parameterSet["sessionRef"] -eq "null")
{
#When a disconnected server is selected there is no session information, we get null for everything except class
}
$SelectedObjectNames += "a disconnected server"
else
{
Connect-XenServer -url $parameterSet["url"] -opaqueref $parameterSet["sessionRef"]
#Use $class to determine which server objects to get
#-properties allows us to filter the results to just include the selected object
$exp = "Get-XenServer:{0} -properties @{{uuid='{1}'}}" -f $parameterSet["class"], $parameterSet["objUuid"]
$obj = Invoke-Expression $exp
$SelectedObjectNames += $obj.name_label;
}
}

@ -0,0 +1,12 @@
from banana import *
class Monkey:
# Bananas the monkey can eat.
capacity = 10
def eat(self, N):
'''Make the monkey eat N bananas!'''
capacity = capacity - N*banana.size
def feeding_frenzy(self):
eat(9.25)
return "Yum yum"

@ -0,0 +1,41 @@
# © Microsoft. All rights reserved.
#' Add together two numbers.
#'
#' @param x A number.
#' @param y A number.
#' @return The sum of \code{x} and \code{y}.
#' @examples
#' add(1, 1)
#' add(10, 1)
add <- function(x, y) {
x + y
}
add(1, 2)
add(1.0, 2.0)
add(-1, -2)
add(-1.0, -2.0)
add(1.0e10, 2.0e10)
#' Concatenate together two strings.
#'
#' @param x A string.
#' @param y A string.
#' @return The concatenated string built of \code{x} and \code{y}.
#' @examples
#' strcat("one", "two")
strcat <- function(x, y) {
paste(x, y)
}
paste("one", "two")
paste('one', 'two')
paste(NULL, NULL)
paste(NA, NA)
paste("multi-
line",
'multi-
line')

@ -0,0 +1,46 @@
@{
var total = 0;
var totalMessage = "";
@* a multiline
razor comment embedded in csharp *@
if (IsPost) {
// Retrieve the numbers that the user entered.
var num1 = Request["text1"];
var num2 = Request["text2"];
// Convert the entered strings into integers numbers and add.
total = num1.AsInt() + num2.AsInt();
<italic><bold>totalMessage = "Total = " + total;</bold></italic>
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Add Numbers</title>
<meta charset="utf-8" />
</head>
<body>
<p>Enter two whole numbers and then click <strong>Add</strong>.</p>
<form action="" method="post">
<p><label for="text1">First Number:</label>
<input type="text" name="text1" />
</p>
<p><label for="text2">Second Number:</label>
<input type="text" name="text2" />
</p>
<p><input type="submit" value="Add" /></p>
</form>
@* now we call the totalMessage method
(a multi line razor comment outside code) *@
<p>@totalMessage</p>
<p>@(totalMessage+"!")</p>
An email address (with escaped at character): name@@domain.com
</body>
</html>

@ -0,0 +1,21 @@
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. All rights reserved.
#--------------------------------------------------------------------------
module Azure
module Blob
class Blob
def initialize
@properties = {}
@metadata = {}
yield self if block_given?
end
attr_accessor :name
attr_accessor :snapshot
attr_accessor :properties
attr_accessor :metadata
end
end
end

@ -0,0 +1,37 @@
$baseFontSizeInPixels: 14;
@function px2em ($font_size, $base_font_size: $baseFontSizeInPixels) {
@return ($font_size / $base_font_size) + em;
}
h1 {
font-size: px2em(36, $baseFontSizeInPixels);
}
h2 {
font-size: px2em(28, $baseFontSizeInPixels);
}
.class {
font-size: px2em(14, $baseFontSizeInPixels);
}
nav {
ul {
margin: 0;
padding: 0;
list-style: none;
}
li { display: inline-block; }
a {
display: block;
padding: 6px 12px;
text-decoration: none;
}
@each $animal in puma, sea-slug, egret, salamander {
.#{$animal}-icon {
background-image: url('/images/#{$animal}.png');
}
}
}

@ -0,0 +1,52 @@
CREATE TABLE dbo.EmployeePhoto
(
EmployeeId INT NOT NULL PRIMARY KEY,
Photo VARBINARY(MAX) FILESTREAM NULL,
MyRowGuidColumn UNIQUEIDENTIFIER NOT NULL ROWGUIDCOL
UNIQUE DEFAULT NEWID()
);
GO
/*
text_of_comment
/* nested comment */
*/
-- line comment
CREATE NONCLUSTERED INDEX IX_WorkOrder_ProductID
ON Production.WorkOrder(ProductID)
WITH (FILLFACTOR = 80,
PAD_INDEX = ON,
DROP_EXISTING = ON);
GO
WHILE (SELECT AVG(ListPrice) FROM Production.Product) < $300
BEGIN
UPDATE Production.Product
SET ListPrice = ListPrice * 2
SELECT MAX(ListPrice) FROM Production.Product
IF (SELECT MAX(ListPrice) FROM Production.Product) > $500
BREAK
ELSE
CONTINUE
END
PRINT 'Too much for the market to bear';
MERGE INTO Sales.SalesReason AS [Target]
USING (VALUES ('Recommendation','Other'), ('Review', 'Marketing'), ('Internet', 'Promotion'))
AS [Source] ([NewName], NewReasonType)
ON [Target].[Name] = [Source].[NewName]
WHEN MATCHED
THEN UPDATE SET ReasonType = [Source].NewReasonType
WHEN NOT MATCHED BY TARGET
THEN INSERT ([Name], ReasonType) VALUES ([NewName], NewReasonType)
OUTPUT $action INTO @SummaryOfChanges;
SELECT ProductID, OrderQty, SUM(LineTotal) AS Total
FROM Sales.SalesOrderDetail
WHERE UnitPrice < $5.00
GROUP BY ProductID, OrderQty
ORDER BY ProductID, OrderQty
OPTION (HASH GROUP, FAST 10);

@ -0,0 +1,50 @@
import Foundation
protocol APIControllerProtocol {
func didReceiveAPIResults(results: NSArray)
}
class APIController {
var delegate: APIControllerProtocol
init(delegate: APIControllerProtocol) {
self.delegate = delegate
}
func get(path: String) {
let url = NSURL(string: path)
let session = NSURLSession.sharedSession()
let task = session.dataTaskWithURL(url!, completionHandler: {data, response, error -> Void in
println("Task completed")
if(error != nil) {
// If there is an error in the web request, print it to the console
println(error.localizedDescription)
}
var err: NSError?
if let jsonResult = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: &err) as? NSDictionary {
if(err != nil) {
// If there is an error parsing JSON, print it to the console
println("JSON Error \(err!.localizedDescription)")
}
if let results: NSArray = jsonResult["results"] as? NSArray {
self.delegate.didReceiveAPIResults(results)
}
}
})
// The task is just an object with all these properties set
// In order to actually make the web request, we need to "resume"
task.resume()
}
func searchItunesFor(searchTerm: String) {
// The iTunes API wants multiple terms separated by + symbols, so replace spaces with + signs
let itunesSearchTerm = searchTerm.stringByReplacingOccurrencesOfString(" ", withString: "+", options: NSStringCompareOptions.CaseInsensitiveSearch, range: nil)
// Now escape anything else that isn't URL-friendly
if let escapedSearchTerm = itunesSearchTerm.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding) {
let urlPath = "https://itunes.apple.com/search?term=\(escapedSearchTerm)&media=music&entity=album"
}
}
}

@ -0,0 +1,124 @@
/* Game of Life
* Implemented in TypeScript
* To learn more about TypeScript, please visit http://www.typescriptlang.org/
*/
module Conway {
export class Cell {
public row: number;
public col: number;
public live: boolean;
constructor(row: number, col: number, live: boolean) {
this.row = row;
this.col = col;
this.live = live
}
}
export class GameOfLife {
private gridSize: number;
private canvasSize: number;
private lineColor: string;
private liveColor: string;
private deadColor: string;
private initialLifeProbability: number;
private animationRate: number;
private cellSize: number;
private context: CanvasRenderingContext2D;
private world;
constructor() {
this.gridSize = 50;
this.canvasSize = 600;
this.lineColor = '#cdcdcd';
this.liveColor = '#666';
this.deadColor = '#eee';
this.initialLifeProbability = 0.5;
this.animationRate = 60;
this.cellSize = 0;
this.world = this.createWorld();
this.circleOfLife();
}
public createWorld() {
return this.travelWorld( (cell : Cell) => {
cell.live = Math.random() < this.initialLifeProbability;
return cell;
});
}
public circleOfLife() : void {
this.world = this.travelWorld( (cell: Cell) => {
cell = this.world[cell.row][cell.col];
this.draw(cell);
return this.resolveNextGeneration(cell);
});
setTimeout( () => {this.circleOfLife()}, this.animationRate);
}
public resolveNextGeneration(cell : Cell) {
var count = this.countNeighbors(cell);
var newCell = new Cell(cell.row, cell.col, cell.live);
if(count < 2 || count > 3) newCell.live = false;
else if(count == 3) newCell.live = true;
return newCell;
}
public countNeighbors(cell : Cell) {
var neighbors = 0;
for(var row = -1; row <=1; row++) {
for(var col = -1; col <= 1; col++) {
if(row == 0 && col == 0) continue;
if(this.isAlive(cell.row + row, cell.col + col)) {
neighbors++;
}
}
}
return neighbors;
}
public isAlive(row : number, col : number) {
if(row < 0 || col < 0 || row >= this.gridSize || col >= this.gridSize) return false;
return this.world[row][col].live;
}
public travelWorld(callback) {
var result = [];
for(var row = 0; row < this.gridSize; row++) {
var rowData = [];
for(var col = 0; col < this.gridSize; col++) {
rowData.push(callback(new Cell(row, col, false)));
}
result.push(rowData);
}
return result;
}
public draw(cell : Cell) {
if(this.context == null) this.context = this.createDrawingContext();
if(this.cellSize == 0) this.cellSize = this.canvasSize/this.gridSize;
this.context.strokeStyle = this.lineColor;
this.context.strokeRect(cell.row * this.cellSize, cell.col*this.cellSize, this.cellSize, this.cellSize);
this.context.fillStyle = cell.live ? this.liveColor : this.deadColor;
this.context.fillRect(cell.row * this.cellSize, cell.col*this.cellSize, this.cellSize, this.cellSize);
}
public createDrawingContext() {
var canvas = <HTMLCanvasElement> document.getElementById('conway-canvas');
if(canvas == null) {
canvas = document.createElement('canvas');
canvas.id = 'conway-canvas';
canvas.width = this.canvasSize;
canvas.height = this.canvasSize;
document.body.appendChild(canvas);
}
return canvas.getContext('2d');
}
}
}
var game = new Conway.GameOfLife();

@ -0,0 +1,59 @@
Imports System
Imports System.Collections.Generic
Module Module1
Sub Main()
Dim a As New M8Ball
Do While True
Dim q As String = ""
Console.Write("ask me about the future... ")
q = Console.ReadLine()
If q.Trim <> "" Then
Console.WriteLine("the answer is... {0}", a.getAnswer(q))
Else
Exit Do
End If
Loop
End Sub
End Module
Class M8Ball
Public Answers As System.Collections.Generic.Dictionary(Of Integer, String)
Public Sub New()
Answers = New System.Collections.Generic.Dictionary(Of Integer, String)
Answers.Add(0, "It is certain")
Answers.Add(1, "It is decidedly so")
Answers.Add(2, "Without a doubt")
Answers.Add(3, "Yes, definitely")
Answers.Add(4, "You may rely on ")
Answers.Add(5, "As I see it, yes")
Answers.Add(6, "Most likely")
Answers.Add(7, "Outlook good")
Answers.Add(8, "Signs point to yes")
Answers.Add(9, "Yes")
Answers.Add(10, "Reply hazy, try again")
Answers.Add(11, "Ask again later")
Answers.Add(12, "Better not tell you now")
Answers.Add(13, "Cannot predict now")
Answers.Add(14, "Concentrate and ask again")
Answers.Add(15, "Don't count on it")
Answers.Add(16, "My reply is no")
Answers.Add(17, "My sources say no")
Answers.Add(18, "Outlook not so")
Answers.Add(19, "Very doubtful")
End Sub
Public Function getAnswer(theQuestion As String) As String
Dim r As New Random
Return Answers(r.Next(0, 19))
End Function
End Class

@ -0,0 +1,14 @@
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add name="MyDB"
connectionString="value for the deployed Web.config file"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
<system.web>
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
</system.web>
</configuration>

@ -0,0 +1,53 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<style>
#errors {
position:fixed;
top:0;
right:0;
font-size: 20px;
width: 100px;
height: 100px;
}
body {
height: 100%;
}
#editor {
float:left;
width: 1250px;
}
</style>
</head>
<body>
<h2>Smoke Test (running from release)</h2>
<a href="./index.html">[MULTIPLE SOURCES]</a>
&nbsp;|&nbsp;
<a href="./index-release.html">[RELEASED]</a>
&nbsp;|&nbsp;
<a href="./smoketest-release.html">[SMOKETEST]</a>
<br/><br/>
<div id="control"></div>
<div id="editor"></div>
<div id="errors"></div>
<div style="clear:both"></div>
<script src="../release/min/vs/loader.js"></script>
<script>
require.config({
paths: {
'vs': '../release/min/vs'
}
});
require(['vs/editor/editor.main'], function() {
require(['./smoketest'], function() {});
});
</script>
</body>
</html>

@ -0,0 +1,165 @@
/// <reference path="../node_modules/monaco-editor-core/monaco.d.ts" />
define([], function() {
var actions = (function() {
"use strict";
return [
{
name: 'Undo',
run: function (editor) {
editor.trigger('keyboard', monaco.editor.Handler.Undo);
}
},
{
name: 'type & suggest',
run: function (editor) {
editor.setPosition({
lineNumber: 1,
column: 1
});
var firstChar = editor.getModel().getLineContent(1).charAt(0);
editor.trigger('keyboard', monaco.editor.Handler.CursorEnd);
editor.trigger('keyboard', monaco.editor.Handler.Type, {
text: '\n' + firstChar
});
editor.focus();
editor.trigger('test', 'editor.action.triggerSuggest');
}
},
{
name: 'links',
run: function (editor) {
editor.setPosition({
lineNumber: 1,
column: 1
});
var commentsSupport = editor.getModel().getMode().commentsSupport;
var text = 'http://www.test.com';
if (commentsSupport) {
var commentsConfig = commentsSupport.getCommentsConfiguration();
if (commentsConfig && commentsConfig.lineCommentTokens) {
text = commentsConfig.lineCommentTokens[0] + ' ' + text;
} else if (commentsConfig && commentsConfig.blockCommentStartToken) {
text = commentsConfig.blockCommentStartToken + ' ' + text + ' ' + commentsConfig.blockCommentEndToken;
}
}
editor.trigger('keyboard', monaco.editor.Handler.Type, {
text: text + '\n'
});
}
},
{
name: 'multicursor',
run: function (editor) {
editor.setPosition({
lineNumber: 1,
column: 1
});
editor.trigger('keyboard', monaco.editor.Handler.AddCursorDown);
editor.trigger('keyboard', monaco.editor.Handler.AddCursorDown);
editor.trigger('keyboard', monaco.editor.Handler.AddCursorDown);
editor.trigger('keyboard', monaco.editor.Handler.AddCursorDown);
editor.trigger('keyboard', monaco.editor.Handler.AddCursorDown);
editor.trigger('keyboard', monaco.editor.Handler.Type, {
text: 'some text - '
});
}
}
];
})();
var panelContainer = document.getElementById('control');
var editorContainer = document.getElementById('editor');
var editors = {}, models = {};
function onError(err) {
console.error(err);
alert('error!!');
}
function getAllModes() {
var result = monaco.languages.getLanguages().map(function(language) { return language.id; });
result.sort();
return result;
}
function createEditor(container, mode) {
editors[mode] = monaco.editor.create(container, {
value: mode
});
xhr('samples/sample.' + mode + '.txt').then(function(response) {
var value = mode + '\n' + response.responseText;
var model = monaco.editor.createModel(value, mode);
editors[mode].setModel(model);
});
}
function createEditors(modes) {
for (var i = 0; i < modes.length; i++) {
var container = document.createElement('div');
container.style.width = '300px';
container.style.cssFloat = 'left';
container.style.height = '200px';
container.style.border = '1px solid #ccc';
container.style.background = 'red';
container.setAttribute('data-mime', modes[i]);
editorContainer.appendChild(container);
createEditor(container, modes[i]);
}
var clearer = document.createElement('div');
clearer.style.clear = 'both';
editorContainer.appendChild(clearer);
}
function executeAction(action) {
for (var mime in editors) {
if (editors.hasOwnProperty(mime)) {
action(editors[mime]);
}
}
}
function createActions(actions) {
for (var i = 0; i < actions.length; i++) {
var btn = document.createElement('button');
btn.appendChild(document.createTextNode('<<' + actions[i].name + '>>'));
btn.onclick = executeAction.bind(this, actions[i].run);
panelContainer.appendChild(btn);
}
}
createEditors(getAllModes());
createActions(actions);
function xhr(url) {
var req = null;
return new monaco.Promise(function(c,e,p) {
req = new XMLHttpRequest();
req.onreadystatechange = function () {
if (req._canceled) { return; }
if (req.readyState === 4) {
if ((req.status >= 200 && req.status < 300) || req.status === 1223) {
c(req);
} else {
e(req);
}
req.onreadystatechange = function () { };
} else {
p(req);
}
};
req.open("GET", url, true );
req.responseType = "";
req.send(null);
}, function () {
req._canceled = true;
req.abort();
});
}
});
Loading…
Cancel
Save