提交 8509d4e4 编写于 作者: M Martin Aeschlimann

even more colorizer tests

上级 34470d18
// from https://msdn.microsoft.com/en-us/library/dd233160.aspx
// The declaration creates a constructor that takes two values, name and age.
type Person(name:string, age:int) =
let mutable internalAge = age
new(name:string) = Person(name, 0)
member this.Name = name
// A read/write property.
member this.Age
with get() = internalAge
and set(value) = internalAge <- value
member this.HasABirthday () = internalAge <- internalAge + 1
member this.IsOfAge targetAge = internalAge >= targetAge
override this.ToString () =
"Name: " + name + "\n" + "Age: " + (string)internalAge
\ No newline at end of file
此差异已折叠。
package main
import (
"encoding/base64"
"fmt"
)
func main() {
dnsName := "test-vm-from-go"
storageAccount := "mystorageaccount"
client, err := management.ClientFromPublishSettingsFile("path/to/downloaded.publishsettings", "")
if err != nil {
panic(err)
}
// create virtual machine
role := vmutils.NewVMConfiguration(dnsName, vmSize)
vmutils.ConfigureDeploymentFromPlatformImage(
&role,
vmImage,
fmt.Sprintf("http://%s.blob.core.windows.net/sdktest/%s.vhd", storageAccount, dnsName),
"")
}
\ No newline at end of file
此差异已折叠。
// Hello World
println "Hello world!"
/*
Variables:
You can assign values to variables for later use
*/
def x = 1
println x
x = new java.util.Date()
println x
x = -3.1499392
println x
x = false
println x
x = "Groovy!"
println x
/*
Collections and maps
*/
//Creating an empty list
def technologies = []
/*** Adding a elements to the list ***/
// As with Java
technologies.add("Grails")
// Left shift adds, and returns the list
technologies << "Groovy"
// Add multiple elements
technologies.addAll(["Gradle","Griffon"])
/*** Removing elements from the list ***/
// As with Java
technologies.remove("Griffon")
// Subtraction works also
technologies = technologies - 'Grails'
/*** Iterating Lists ***/
// Iterate over elements of a list
technologies.each { println "Technology: $it"}
technologies.eachWithIndex { it, i -> println "$i: $it"}
/*** Checking List contents ***/
//Evaluate if a list contains element(s) (boolean)
contained = technologies.contains( 'Groovy' )
// Or
contained = 'Groovy' in technologies
// To sort without mutating original, you can do:
sortedTechnologies = technologies.sort( false )
//Replace all elements in the list
Collections.replaceAll(technologies, 'Gradle', 'gradle')
//Shuffle a list
Collections.shuffle(technologies, new Random())
//Clear a list
technologies.clear()
//Creating an empty map
def devMap = [:]
//Add values
devMap = ['name':'Roberto', 'framework':'Grails', 'language':'Groovy']
devMap.put('lastName','Perez')
//Iterate over elements of a map
devMap.each { println "$it.key: $it.value" }
devMap.eachWithIndex { it, i -> println "$i: $it"}
//Evaluate if a map contains a key
assert devMap.containsKey('name')
//Get the keys of a map
println devMap.keySet()
class Foo {
// read only property
final String name = "Roberto"
// read only property with public getter and protected setter
String language
protected void setLanguage(String language) { this.language = language }
// dynamically typed property
def lastName
}
/*
Logical Branching and Looping
*/
//Groovy supports the usual if - else syntax
def x = 3
if(x==1) {
println "One"
} else if(x==2) {
println "Two"
} else {
println "X greater than Two"
}
//Groovy also supports the ternary operator:
def y = 10
def x = (y > 1) ? "worked" : "failed"
assert x == "worked"
//Groovy supports 'The Elvis Operator' too!
//Instead of using the ternary operator:
displayName = user.name ? user.name : 'Anonymous'
//We can write it:
displayName = user.name ?: 'Anonymous'
//For loop
//Iterate over a range
def x = 0
for (i in 0 .. 30) {
x += i
}
//Iterate over a list
x = 0
for( i in [5,3,2,1] ) {
x += i
}
//Iterate over an array
array = (0..20).toArray()
x = 0
for (i in array) {
x += i
}
//Iterate over a map
def map = ['name':'Roberto', 'framework':'Grails', 'language':'Groovy']
x = 0
for ( e in map ) {
x += e.value
}
def technologies = ['Groovy','Grails','Gradle']
technologies*.toUpperCase() // = to technologies.collect { it?.toUpperCase() }
def user = User.get(1)
def username = user?.username
def clos = { println "Hello World!" }
def sum = { a, b -> println a+b }
sum(2,4)
def x = 5
def multiplyBy = { num -> num * x }
println multiplyBy(10)
def clos = { print it }
clos( "hi" )
def cl = {a, b ->
sleep(3000) // simulate some time consuming processing
a + b
}
mem = cl.memoize()
def callClosure(a, b) {
def start = System.currentTimeMillis()
mem(a, b)
println "Inputs(a = $a, b = $b) - took ${System.currentTimeMillis() - start} msecs."
}
callClosure(1, 2)
//Another example:
import groovy.transform.TypeChecked
@TypeChecked
Integer test() {
Integer num = "1"
Integer[] numbers = [1,2,3,4]
Date date = numbers[1]
return "Test"
}
//CompileStatic example:
import groovy.transform.CompileStatic
@CompileStatic
int sum(int x, int y) {
x + y
}
assert sum(2,5) == 7
; last modified 1 April 2001 by John Doe
[owner]
name=John Doe
organization=Acme Widgets Inc.
[database]
; use IP address in case network name resolution is not working
server=192.0.2.62
port=143
file="payroll.dat"
\ No newline at end of file
[
{
"c": ";",
"t": "comment.line.semicolon.ini.punctuation.definition",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.comment",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.comment",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.comment",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.comment",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.comment"
}
},
{
"c": " last modified 1 April 2001 by John Doe",
"t": "comment.line.semicolon.ini",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.comment",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.comment",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.comment",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.comment",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.comment"
}
},
{
"c": "[",
"t": "ini.punctuation.definition.entity.name.section.group-title",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": "owner",
"t": "ini.entity.name.section.group-title",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": "]",
"t": "ini.punctuation.definition.entity.name.section.group-title",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": "name",
"t": "ini.definition.keyword.other",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.keyword",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.keyword",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.keyword"
}
},
{
"c": "=",
"t": "ini.punctuation.separator.key-value",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": "John Doe",
"t": "",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": "organization",
"t": "ini.definition.keyword.other",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.keyword",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.keyword",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.keyword"
}
},
{
"c": "=",
"t": "ini.punctuation.separator.key-value",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": "Acme Widgets Inc.",
"t": "",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": "[",
"t": "ini.punctuation.definition.entity.name.section.group-title",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": "database",
"t": "ini.entity.name.section.group-title",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": "]",
"t": "ini.punctuation.definition.entity.name.section.group-title",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": ";",
"t": "comment.line.semicolon.ini.punctuation.definition",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.comment",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.comment",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.comment",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.comment",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.comment"
}
},
{
"c": " use IP address in case network name resolution is not working",
"t": "comment.line.semicolon.ini",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.comment",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.comment",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.comment",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.comment",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.comment"
}
},
{
"c": "server",
"t": "ini.definition.keyword.other",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.keyword",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.keyword",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.keyword"
}
},
{
"c": "=",
"t": "ini.punctuation.separator.key-value",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": "192.0.2.62",
"t": "",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": "port",
"t": "ini.definition.keyword.other",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.keyword",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.keyword",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.keyword"
}
},
{
"c": "=",
"t": "ini.punctuation.separator.key-value",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": "143",
"t": "",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": "file",
"t": "ini.definition.keyword.other",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.keyword",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.keyword",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.keyword"
}
},
{
"c": "=",
"t": "ini.punctuation.separator.key-value",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": "\"",
"t": "ini.punctuation.definition.string.quoted.double.begin",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.string",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.string",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.string",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.string",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.string"
}
},
{
"c": "payroll.dat",
"t": "ini.string.quoted.double",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.string",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.string",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.string",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.string",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.string"
}
},
{
"c": "\"",
"t": "ini.punctuation.definition.string.quoted.double.end",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.string",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.string",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.string",
"light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.string",
"hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.string"
}
}
]
\ No newline at end of file
-- defines a factorial function
function fact (n)
if n == 0 then
return 1
else
return n * fact(n-1)
end
end
print("enter a number:")
a = io.read("*number") -- read a number
print(fact(a))
\ No newline at end of file
此差异已折叠。
all: hello
hello: main.o factorial.o hello.o
g++ main.o factorial.o hello.o -o hello
main.o: main.cpp
g++ -c main.cpp
factorial.o: factorial.cpp
g++ -c factorial.cpp
hello.o: hello.cpp
g++ -c hello.cpp
clean:
rm *o hello
\ No newline at end of file
[
{
"c": "all",
"t": "meta.scope.target.makefile.entity.name.function",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.entity.name.function",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.entity.name.function",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.entity.name.function",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": ":",
"t": "meta.scope.target.makefile.punctuation.separator.key-value",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": " hello",
"t": "meta.scope.target.makefile.prerequisites",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": "hello",
"t": "meta.scope.target.makefile.entity.name.function",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.entity.name.function",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.entity.name.function",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.entity.name.function",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": ":",
"t": "meta.scope.target.makefile.punctuation.separator.key-value",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": " main.o factorial.o hello.o",
"t": "meta.scope.target.makefile.prerequisites",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": " g++ main.o factorial.o hello.o -o hello",
"t": "",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": "main.o",
"t": "meta.scope.target.makefile.entity.name.function",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.entity.name.function",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.entity.name.function",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.entity.name.function",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": ":",
"t": "meta.scope.target.makefile.punctuation.separator.key-value",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": " main.cpp",
"t": "meta.scope.target.makefile.prerequisites",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": " g++ -c main.cpp",
"t": "",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": "factorial.o",
"t": "meta.scope.target.makefile.entity.name.function",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.entity.name.function",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.entity.name.function",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.entity.name.function",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": ":",
"t": "meta.scope.target.makefile.punctuation.separator.key-value",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": " factorial.cpp",
"t": "meta.scope.target.makefile.prerequisites",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": " g++ -c factorial.cpp",
"t": "",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": "hello.o",
"t": "meta.scope.target.makefile.entity.name.function",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.entity.name.function",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.entity.name.function",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.entity.name.function",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": ":",
"t": "meta.scope.target.makefile.punctuation.separator.key-value",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": " hello.cpp",
"t": "meta.scope.target.makefile.prerequisites",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": " g++ -c hello.cpp",
"t": "",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": "clean",
"t": "meta.scope.target.makefile.entity.name.function",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.entity.name.function",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.entity.name.function",
"dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.entity.name.function",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": ":",
"t": "meta.scope.target.makefile.punctuation.separator.key-value",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
},
{
"c": " rm *o hello",
"t": "",
"r": {
"dark_plus": ".vs-dark .token",
"light_plus": ".vs .token",
"dark_vs": ".vs-dark .token",
"light_vs": ".vs .token",
"hc_black": ".hc-black .token"
}
}
]
\ No newline at end of file
# Header 1 #
## Header 2 ##
### Header 3 ### (Hashes on right are optional)
## Markdown plus h2 with a custom ID ## {#id-goes-here}
[Link back to H2](#id-goes-here)
<!-- html madness -->
<div class="custom-class" markdown="1">
<div>
nested div
</div>
<script type='text/x-koka'>
function( x: int ) { return x*x; }
</script>
This is a div _with_ underscores
and a & <b class="bold">bold</b> element.
<style>
body { font: "Consolas" }
</style>
</div>
* Bullet lists are easy too
- Another one
+ Another one
This is a paragraph, which is text surrounded by
whitespace. Paragraphs can be on one
line (or many), and can drone on for hours.
Now some inline markup like _italics_, **bold**,
and `code()`. Note that underscores
in_words_are ignored.
````application/json
{ value: ["or with a mime type"] }
````
> Blockquotes are like quoted text in email replies
>> And, they can be nested
1. A numbered list
2. Which is numbered
3. With periods and a space
And now some code:
// Code is just text indented a bit
which(is_easy) to_remember();
And a block
~~~
// Markdown extra adds un-indented code blocks too
if (this_is_more_code == true && !indented) {
// tild wrapped code blocks, also not indented
}
~~~
Text with
two trailing spaces
(on the right)
can be used
for things like poems
### Horizontal rules
* * * *
****
--------------------------
![picture alt](/images/photo.jpeg "Title is optional")
## Markdown plus tables ##
| Header | Header | Right |
| ------ | ------ | -----: |
| Cell | Cell | $10 |
| Cell | Cell | $20 |
* Outer pipes on tables are optional
* Colon used for alignment (right versus left)
## Markdown plus definition lists ##
Bottled water
: $ 1.25
: $ 1.55 (Large)
Milk
Pop
: $ 1.75
* Multiple definitions and terms are possible
* Definitions can include multiple paragraphs too
*[ABBR]: Markdown plus abbreviations (produces an <abbr> tag)
\ No newline at end of file
此差异已折叠。
//
// 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
use strict;
my $badfound = 0;
sub check_line {
my($fn, $line) = @_;
# Check for that =.
if($line =~ /^\s*if\s*\(.*[^!<>=]=([^=].*\)|\))/) {
if(!$badfound) {
print("The following suspicious lines were found:\n");
$badfound = 1;
}
print "$fn:$.: $line\n";
}
}
#
# This function opens and reads one file, and calls
# check_line to analyze each line. Call it with the
# file name.
#
sub check_file {
my($fn) = @_;
if(!open(IN, $fn)) {
print "Cannot read $fn.\n";
return;
}
my($line);
while($line = <IN>)
{
chomp $line;
check_line($fn,$line);
}
close IN;
}
#
# Go through the argument list and check each file
#
while(my $fn = shift @ARGV) {
check_file($fn);
}
if(!$badfound) { print "No suspicious lines were found.\n"; }
\ No newline at end of file
此差异已折叠。
<html>
<head>
<title>Example page</title>
</head>
<body>
<?php
function functionName(){
// Code to be executed
}
/* Example PHP file
multiline comment
*/
$cards = array("ah", "ac", "ad", "as",
"2h", "2c", "2d", "2s");
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> ");
$starting_point++;
}
?>
</body>
</html>
\ No newline at end of file
此差异已折叠。
# Copyright Microsoft Corporation
function Test-IsAdmin() {
try {
$identity = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object Security.Principal.WindowsPrincipal -ArgumentList $identity
return $principal.IsInRole( [Security.Principal.WindowsBuiltInRole]::Administrator )
} catch {
throw "Failed to determine if the current user has elevated privileges. The error was: '{0}'." -f $_
}
}
function Invoke-Environment()
{
param
(
[Parameter(Mandatory=1)][string]$Command
)
foreach($_ in cmd /c "$Command 2>&1 & set") {
if ($_ -match '^([^=]+)=(.*)') {
[System.Environment]::SetEnvironmentVariable($matches[1], $matches[2])
}
}
}
Write-Host -Object 'Initializing Azure PowerShell environment...';
# PowerShell commands need elevation for dependencies installation and running tests
if (!(Test-IsAdmin)){
Write-Host -Object 'Please launch command under administrator account. It is needed for environment setting up and unit test.' -ForegroundColor Red;
}
$env:AzurePSRoot = Split-Path -Parent -Path $env:AzurePSRoot;
if (Test-Path -Path "$env:ADXSDKProgramFiles\Microsoft Visual Studio 12.0") {
$vsVersion="12.0"
} else {
$vsVersion="11.0"
}
$setVSEnv = '"{0}\Microsoft Visual Studio {1}\VC\vcvarsall.bat" x64' -f $env:ADXSDKProgramFiles, $vsVersion;
Invoke-Environment -Command $setVSEnv;
\ No newline at end of file
from banana import *
class Monkey:
# Bananas the monkey can eat.
capacity = 10
def eat(self, N):
'''Make the monkey eat N bananas!'''
capacity = capacity - N*banana.size
def feeding_frenzy(self):
eat(9.25)
return "Yum yum"
\ No newline at end of file
此差异已折叠。
# © 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, 2.0)
add(1.0e10, 2.0e10)
paste("one", NULL)
paste(NA, 'two')
paste("multi-
line",
'multi-
line')
此差异已折叠。
# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::ARM::Scheduler
#
# A service client - single point of access to the REST API.
#
class SchedulerManagementClient < MsRestAzure::AzureServiceClient
include Azure::ARM::Scheduler::Models
include MsRestAzure
# @return job_collections
attr_reader :job_collections
#
# Creates initializes a new instance of the SchedulerManagementClient class.
# @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
# @param base_url [String] the base URI of the service.
# @param options [Array] filters to be applied to the HTTP requests.
#
def initialize(credentials, base_url = nil, options = nil)
super(credentials, options)
@base_url = base_url || 'https://management.azure.com'
fail ArgumentError, 'credentials is nil' if credentials.nil?
fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials)
@credentials = credentials
@job_collections = JobCollections.new(self)
@jobs = Jobs.new(self)
@api_version = '2016-01-01'
@long_running_operation_retry_timeout = 30
@generate_client_request_id = true
if MacOS.version >= :mavericks
version = `#{MAVERICKS_PKG_PATH}/usr/bin/clang --version`
else
version = `/usr/bin/clang --version`
end
version = version[/clang-(\d+\.\d+\.\d+(\.\d+)?)/, 1] || "0"
version < latest_version
end
end
end
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册