mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 08:10:11 +01:00
CRLF -> LF
This commit is contained in:
parent
d7ac67dbf8
commit
aa75ddccbb
42 changed files with 41762 additions and 41762 deletions
|
|
@ -1,38 +1,38 @@
|
|||
/*
|
||||
* C# Program to Display All the Prime Numbers Between 1 to 100
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace VS
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
bool isPrime = true;
|
||||
Console.WriteLine("Prime Numbers : ");
|
||||
for (int i = 2; i <= 100; i++)
|
||||
{
|
||||
for (int j = 2; j <= 100; j++)
|
||||
{
|
||||
if (i != j && i % j == 0)
|
||||
{
|
||||
isPrime = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isPrime)
|
||||
{
|
||||
Console.Write("\t" +i);
|
||||
}
|
||||
isPrime = true;
|
||||
}
|
||||
Console.ReadKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* C# Program to Display All the Prime Numbers Between 1 to 100
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace VS
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
bool isPrime = true;
|
||||
Console.WriteLine("Prime Numbers : ");
|
||||
for (int i = 2; i <= 100; i++)
|
||||
{
|
||||
for (int j = 2; j <= 100; j++)
|
||||
{
|
||||
if (i != j && i % j == 0)
|
||||
{
|
||||
isPrime = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isPrime)
|
||||
{
|
||||
Console.Write("\t" +i);
|
||||
}
|
||||
isPrime = true;
|
||||
}
|
||||
Console.ReadKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,32 +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
|
||||
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'
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
(* Sample F# application *)
|
||||
[<EntryPoint>]
|
||||
let main argv =
|
||||
printfn "%A" argv
|
||||
System.Console.WriteLine("Hello from F#")
|
||||
0 // return an integer exit code
|
||||
|
||||
//--------------------------------------------------------
|
||||
(* Sample F# application *)
|
||||
[<EntryPoint>]
|
||||
let main argv =
|
||||
printfn "%A" argv
|
||||
System.Console.WriteLine("Hello from F#")
|
||||
0 // return an integer exit code
|
||||
|
||||
//--------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,111 +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))
|
||||
|
||||
}
|
||||
// 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))
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,48 +1,48 @@
|
|||
terraform {
|
||||
required_providers {
|
||||
aws = {
|
||||
source = "hashicorp/aws"
|
||||
version = "~> 1.0.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
variable "aws_region" {}
|
||||
|
||||
variable "base_cidr_block" {
|
||||
description = "A /16 CIDR range definition, such as 10.1.0.0/16, that the VPC will use"
|
||||
default = "10.1.0.0/16"
|
||||
}
|
||||
|
||||
variable "availability_zones" {
|
||||
description = "A list of availability zones in which to create subnets"
|
||||
type = list(string)
|
||||
}
|
||||
|
||||
provider "aws" {
|
||||
region = var.aws_region
|
||||
}
|
||||
|
||||
resource "aws_vpc" "main" {
|
||||
# Referencing the base_cidr_block variable allows the network address
|
||||
# to be changed without modifying the configuration.
|
||||
cidr_block = var.base_cidr_block
|
||||
}
|
||||
|
||||
resource "aws_subnet" "az" {
|
||||
# Create one subnet for each given availability zone.
|
||||
count = length(var.availability_zones)
|
||||
|
||||
# For each subnet, use one of the specified availability zones.
|
||||
availability_zone = var.availability_zones[count.index]
|
||||
|
||||
# By referencing the aws_vpc.main object, Terraform knows that the subnet
|
||||
# must be created only after the VPC is created.
|
||||
vpc_id = aws_vpc.main.id
|
||||
|
||||
# Built-in functions and operators can be used for simple transformations of
|
||||
# values, such as computing a subnet address. Here we create a /20 prefix for
|
||||
# each subnet, using consecutive addresses for each availability zone,
|
||||
# such as 10.1.16.0/20 .
|
||||
cidr_block = cidrsubnet(aws_vpc.main.cidr_block, 4, count.index+1)
|
||||
}
|
||||
terraform {
|
||||
required_providers {
|
||||
aws = {
|
||||
source = "hashicorp/aws"
|
||||
version = "~> 1.0.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
variable "aws_region" {}
|
||||
|
||||
variable "base_cidr_block" {
|
||||
description = "A /16 CIDR range definition, such as 10.1.0.0/16, that the VPC will use"
|
||||
default = "10.1.0.0/16"
|
||||
}
|
||||
|
||||
variable "availability_zones" {
|
||||
description = "A list of availability zones in which to create subnets"
|
||||
type = list(string)
|
||||
}
|
||||
|
||||
provider "aws" {
|
||||
region = var.aws_region
|
||||
}
|
||||
|
||||
resource "aws_vpc" "main" {
|
||||
# Referencing the base_cidr_block variable allows the network address
|
||||
# to be changed without modifying the configuration.
|
||||
cidr_block = var.base_cidr_block
|
||||
}
|
||||
|
||||
resource "aws_subnet" "az" {
|
||||
# Create one subnet for each given availability zone.
|
||||
count = length(var.availability_zones)
|
||||
|
||||
# For each subnet, use one of the specified availability zones.
|
||||
availability_zone = var.availability_zones[count.index]
|
||||
|
||||
# By referencing the aws_vpc.main object, Terraform knows that the subnet
|
||||
# must be created only after the VPC is created.
|
||||
vpc_id = aws_vpc.main.id
|
||||
|
||||
# Built-in functions and operators can be used for simple transformations of
|
||||
# values, such as computing a subnet address. Here we create a /20 prefix for
|
||||
# each subnet, using consecutive addresses for each availability zone,
|
||||
# such as 10.1.16.0/20 .
|
||||
cidr_block = cidrsubnet(aws_vpc.main.cidr_block, 4, count.index+1)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,100 +1,100 @@
|
|||
<!DOCTYPE HTML>
|
||||
<!--Example of comments in HTML-->
|
||||
<html>
|
||||
<head>
|
||||
<!--This is the head section-->
|
||||
<title>HTML Sample</title>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<!--This is the style tag to set style on elements-->
|
||||
<style type="text/css">
|
||||
h1
|
||||
{
|
||||
font-family: Tahoma;
|
||||
font-size: 40px;
|
||||
font-weight: normal;
|
||||
margin: 50px;
|
||||
color: #a0a0a0;
|
||||
}
|
||||
|
||||
h2
|
||||
{
|
||||
font-family: Tahoma;
|
||||
font-size: 30px;
|
||||
font-weight: normal;
|
||||
margin: 50px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
p
|
||||
{
|
||||
font-family: Tahoma;
|
||||
font-size: 17px;
|
||||
font-weight: normal;
|
||||
margin: 0px 200px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
div.Center
|
||||
{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.Blue
|
||||
{
|
||||
padding: 50px;
|
||||
background-color: #7bd2ff;
|
||||
}
|
||||
|
||||
button.Gray
|
||||
{
|
||||
font-family: Tahoma;
|
||||
font-size: 17px;
|
||||
font-weight: normal;
|
||||
margin-top: 100px;
|
||||
padding: 10px 50px;
|
||||
background-color: #727272;
|
||||
color: #fff;
|
||||
outline: 0;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button.Gray:hover
|
||||
{
|
||||
background-color: #898888;
|
||||
}
|
||||
|
||||
button.Gray:active
|
||||
{
|
||||
background-color: #636161;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<!--This is the script tag-->
|
||||
<script type="text/javascript">
|
||||
function ButtonClick(){
|
||||
// Example of comments in JavaScript
|
||||
window.alert("I'm an alert sample!");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<!--This is the body section-->
|
||||
<div class="Center">
|
||||
<h1>NAME OF SITE</h1>
|
||||
</div>
|
||||
<div class="Center Blue">
|
||||
<h2>I'm h2 Header! Edit me in <h2></h2>
|
||||
<p>
|
||||
I'm a paragraph! Edit me in <p>
|
||||
to add your own content and make changes to the style and font.
|
||||
It's easy! Just change the text between <p> ... </p> and change the style in <style>.
|
||||
You can make it as long as you wish. The browser will automatically wrap the lines to accommodate the
|
||||
size of the browser window.
|
||||
</p>
|
||||
<button class="Gray" onclick="ButtonClick()">Click Me!</button>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE HTML>
|
||||
<!--Example of comments in HTML-->
|
||||
<html>
|
||||
<head>
|
||||
<!--This is the head section-->
|
||||
<title>HTML Sample</title>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<!--This is the style tag to set style on elements-->
|
||||
<style type="text/css">
|
||||
h1
|
||||
{
|
||||
font-family: Tahoma;
|
||||
font-size: 40px;
|
||||
font-weight: normal;
|
||||
margin: 50px;
|
||||
color: #a0a0a0;
|
||||
}
|
||||
|
||||
h2
|
||||
{
|
||||
font-family: Tahoma;
|
||||
font-size: 30px;
|
||||
font-weight: normal;
|
||||
margin: 50px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
p
|
||||
{
|
||||
font-family: Tahoma;
|
||||
font-size: 17px;
|
||||
font-weight: normal;
|
||||
margin: 0px 200px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
div.Center
|
||||
{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.Blue
|
||||
{
|
||||
padding: 50px;
|
||||
background-color: #7bd2ff;
|
||||
}
|
||||
|
||||
button.Gray
|
||||
{
|
||||
font-family: Tahoma;
|
||||
font-size: 17px;
|
||||
font-weight: normal;
|
||||
margin-top: 100px;
|
||||
padding: 10px 50px;
|
||||
background-color: #727272;
|
||||
color: #fff;
|
||||
outline: 0;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button.Gray:hover
|
||||
{
|
||||
background-color: #898888;
|
||||
}
|
||||
|
||||
button.Gray:active
|
||||
{
|
||||
background-color: #636161;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<!--This is the script tag-->
|
||||
<script type="text/javascript">
|
||||
function ButtonClick(){
|
||||
// Example of comments in JavaScript
|
||||
window.alert("I'm an alert sample!");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<!--This is the body section-->
|
||||
<div class="Center">
|
||||
<h1>NAME OF SITE</h1>
|
||||
</div>
|
||||
<div class="Center Blue">
|
||||
<h2>I'm h2 Header! Edit me in <h2></h2>
|
||||
<p>
|
||||
I'm a paragraph! Edit me in <p>
|
||||
to add your own content and make changes to the style and font.
|
||||
It's easy! Just change the text between <p> ... </p> and change the style in <style>.
|
||||
You can make it as long as you wish. The browser will automatically wrap the lines to accommodate the
|
||||
size of the browser window.
|
||||
</p>
|
||||
<button class="Gray" onclick="ButtonClick()">Click Me!</button>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,15 +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
|
||||
# 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
|
||||
|
|
|
|||
|
|
@ -1,214 +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);
|
||||
|
||||
/*
|
||||
© 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);
|
||||
|
|
@ -1,68 +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
|
||||
}
|
||||
}
|
||||
{
|
||||
"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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +1,28 @@
|
|||
const val POINTS_X_PASS: Int = 15
|
||||
val EZPassAccounts: MutableMap<Int, Int> = mutableMapOf(1 to 100, 2 to 100, 3 to 100)
|
||||
val EZPassReport: Map<Int, Int> = EZPassAccounts
|
||||
|
||||
// update points credit
|
||||
fun updatePointsCredit(accountId: Int) {
|
||||
if (EZPassAccounts.containsKey(accountId)) {
|
||||
println("Updating $accountId...")
|
||||
EZPassAccounts[accountId] = EZPassAccounts.getValue(accountId) + POINTS_X_PASS
|
||||
} else {
|
||||
println("Error: Trying to update a non-existing account (id: $accountId)")
|
||||
}
|
||||
}
|
||||
|
||||
fun accountsReport() {
|
||||
println("EZ-Pass report:")
|
||||
EZPassReport.forEach{
|
||||
k, v -> println("ID $k: credit $v")
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
accountsReport()
|
||||
updatePointsCredit(1)
|
||||
updatePointsCredit(1)
|
||||
updatePointsCredit(5)
|
||||
accountsReport()
|
||||
const val POINTS_X_PASS: Int = 15
|
||||
val EZPassAccounts: MutableMap<Int, Int> = mutableMapOf(1 to 100, 2 to 100, 3 to 100)
|
||||
val EZPassReport: Map<Int, Int> = EZPassAccounts
|
||||
|
||||
// update points credit
|
||||
fun updatePointsCredit(accountId: Int) {
|
||||
if (EZPassAccounts.containsKey(accountId)) {
|
||||
println("Updating $accountId...")
|
||||
EZPassAccounts[accountId] = EZPassAccounts.getValue(accountId) + POINTS_X_PASS
|
||||
} else {
|
||||
println("Error: Trying to update a non-existing account (id: $accountId)")
|
||||
}
|
||||
}
|
||||
|
||||
fun accountsReport() {
|
||||
println("EZ-Pass report:")
|
||||
EZPassReport.forEach{
|
||||
k, v -> println("ID $k: credit $v")
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
accountsReport()
|
||||
updatePointsCredit(1)
|
||||
updatePointsCredit(1)
|
||||
updatePointsCredit(5)
|
||||
accountsReport()
|
||||
}
|
||||
|
|
@ -1,46 +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%);
|
||||
}
|
||||
@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%);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,104 +1,104 @@
|
|||
# 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)
|
||||
|
||||
```js
|
||||
var x = "string";
|
||||
function f() {
|
||||
return x;
|
||||
}
|
||||
```
|
||||
|
||||
<!-- 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
|
||||
|
||||
* * * *
|
||||
****
|
||||
--------------------------
|
||||
|
||||

|
||||
|
||||
## 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
|
||||
|
||||
# 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)
|
||||
|
||||
```js
|
||||
var x = "string";
|
||||
function f() {
|
||||
return x;
|
||||
}
|
||||
```
|
||||
|
||||
<!-- 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
|
||||
|
||||
* * * *
|
||||
****
|
||||
--------------------------
|
||||
|
||||

|
||||
|
||||
## 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)
|
||||
|
|
@ -1,52 +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
|
||||
//
|
||||
// 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
|
||||
|
|
|
|||
|
|
@ -1,82 +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>
|
||||
<?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>
|
||||
|
|
@ -1,9 +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.
|
||||
|
||||
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.
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
import banana
|
||||
|
||||
|
||||
class Monkey:
|
||||
# Bananas the monkey can eat.
|
||||
capacity = 10
|
||||
def eat(self, n):
|
||||
"""Make the monkey eat n bananas!"""
|
||||
self.capacity -= n * banana.size
|
||||
|
||||
def feeding_frenzy(self):
|
||||
self.eat(9.25)
|
||||
return "Yum yum"
|
||||
import banana
|
||||
|
||||
|
||||
class Monkey:
|
||||
# Bananas the monkey can eat.
|
||||
capacity = 10
|
||||
def eat(self, n):
|
||||
"""Make the monkey eat n bananas!"""
|
||||
self.capacity -= n * banana.size
|
||||
|
||||
def feeding_frenzy(self):
|
||||
self.eat(9.25)
|
||||
return "Yum yum"
|
||||
|
|
|
|||
|
|
@ -1,41 +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')
|
||||
# © 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')
|
||||
|
|
|
|||
|
|
@ -1,46 +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>
|
||||
@{
|
||||
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>
|
||||
|
|
|
|||
|
|
@ -1,21 +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
|
||||
#-------------------------------------------------------------------------
|
||||
# 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
|
||||
|
|
@ -1,37 +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');
|
||||
}
|
||||
}
|
||||
$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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,50 +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"
|
||||
}
|
||||
}
|
||||
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,124 +1,124 @@
|
|||
/* Game of Life
|
||||
* Implemented in TypeScript
|
||||
* To learn more about TypeScript, please visit http://www.typescriptlang.org/
|
||||
*/
|
||||
|
||||
namespace 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();
|
||||
/* Game of Life
|
||||
* Implemented in TypeScript
|
||||
* To learn more about TypeScript, please visit http://www.typescriptlang.org/
|
||||
*/
|
||||
|
||||
namespace 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();
|
||||
|
|
|
|||
|
|
@ -1,59 +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
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,14 +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>
|
||||
<?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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue