This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
#if !CompactFramework | |
using System.Runtime.Serialization; | |
#endif | |
using System.Collections.Generic; | |
using System.Text; | |
using System.Diagnostics; | |
namespace Mentor.Utilities | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* I wrote an application-agnostic UndoStack class for my own diagramming tool. It's easy to use, for example here's how you might write code to delete a shape: | |
UndoStack _undoStack = new UndoStack(); | |
... | |
void DeleteShape(GraphicElement el) | |
{ | |
_undoStack.Do(@do => { | |
if (@do) { | |
// Code to delete the shape | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace Loyc | |
{ | |
/// <summary>Extension methods that add some functionality of <c>string</c> to <c>StringBuilder</c>.</summary> | |
public static class StringBuilderExt | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******************************************************************************* | |
* * | |
* Author : Angus Johnson * | |
* Edited by : David Piepgrass * | |
* Version : 4.7 + edits * | |
* Date : 15 February 2012 * | |
* Website : http://www.angusj.com * | |
* Copyright : Angus Johnson 2010-2012 * | |
* * | |
* Note: I, David Piepgrass, refactored this library from its original version * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react'; | |
import * as ReactDOM from 'react-dom'; | |
class App extends React.Component<{greeting: string}, {count:number}> { | |
state = {count: 0}; | |
render() { | |
return ( | |
<div> | |
<h2>{this.props.greeting}</h2> | |
<button onClick={() => this.setState( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>App</title> | |
<meta charset="utf-8"/> | |
</head> | |
<body> | |
<h1>Mini React app ❤</h1> | |
<div id="app"></div> | |
<script src="app.tsx"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ // TypeScript configuration file: provides options to the TypeScript | |
// compiler (tsc) and makes VSCode recognize this folder as a TS project, | |
// enabling the VSCode build tasks "tsc: build" and "tsc: watch". | |
"compilerOptions": { | |
"target": "es5", // Compatible with older browsers | |
"module": "umd", // Compatible with both Node.js and browser | |
"moduleResolution": "node", // Tell tsc to look in node_modules for modules | |
"sourceMap": true, // Creates *.js.map files | |
"jsx": "react", // Causes inline XML (JSX code) to be expanded | |
"strict": true, // Strict types, eg. prohibits `var x=0; x=null` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require("http"); // http server | |
var fs = require("fs"); // file system access | |
var url = require("url"); // url parser | |
var path = require("path"); // file path parser | |
// You can choose the port via command line, e.g. node server.js 3000 | |
const port = process.argv[2] || '1234'; | |
const folderToServe = 'app'; | |
const mimeTypes = { | |
'.ico': 'image/x-icon', | |
'.html': 'text/html', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>App</title> | |
<meta charset="utf-8"/> | |
<script src="node_modules/react/umd/react.development.js"></script> | |
<script src="node_modules/react-dom/umd/react-dom.development.js"></script> | |
<script src="node_modules/preact/dist/preact.dev.js"></script> | |
<script> | |
module = {exports:{}}; exports = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"scripts": { | |
"test": "echo \"Error: no tests installed\" && exit 1", | |
"build": "webpack app/app.tsx --module-bind tsx=awesome-typescript-loader -o app/app.bundle.js --mode=production", | |
"build:dev": "webpack app/app.tsx --module-bind tsx=awesome-typescript-loader -o app/app.bundle.js --mode=development", | |
"watch": "webpack app/app.tsx --module-bind tsx=awesome-typescript-loader -o app/app.bundle.js --mode=development --watch", | |
"start": "node server.js" | |
}, |
OlderNewer