diff options
-rw-r--r-- | csharp.html.markdown | 40 | ||||
-rw-r--r-- | es-es/ruby-es.html.markdown | 8 | ||||
-rw-r--r-- | hjson.html.markdown | 94 | ||||
-rw-r--r-- | powershell.html.markdown | 2 | ||||
-rw-r--r-- | pt-br/tmux-pt.html.markdown | 48 | ||||
-rw-r--r-- | rdf.html.markdown | 161 | ||||
-rw-r--r-- | zh-cn/gdscript-cn.html.markdown | 3 | ||||
-rw-r--r-- | zh-cn/powershell-cn.html.markdown | 6 |
8 files changed, 311 insertions, 51 deletions
diff --git a/csharp.html.markdown b/csharp.html.markdown index 4f9b71ce..1d7d0881 100644 --- a/csharp.html.markdown +++ b/csharp.html.markdown @@ -158,7 +158,7 @@ on a new line! ""Wow!"", the masses cried"; // Arrays - zero indexed // The array size must be decided upon declaration - // The format for declaring an array is follows: + // The format for declaring an array is // <datatype>[] <var name> = new <datatype>[<array size>]; int[] intArray = new int[10]; @@ -172,7 +172,7 @@ on a new line! ""Wow!"", the masses cried"; // Lists // Lists are used more frequently than arrays as they are more flexible - // The format for declaring a list is follows: + // The format for declaring a list is // List<datatype> <var name> = new List<datatype>(); List<int> intList = new List<int>(); List<string> stringList = new List<string>(); @@ -182,14 +182,14 @@ on a new line! ""Wow!"", the masses cried"; // Lists don't default to a value; // A value must be added before accessing the index intList.Add(1); - Console.WriteLine("intList @ 0: " + intList[0]); + Console.WriteLine("intList at 0: " + intList[0]); - // Others data structures to check out: + // Other data structures to check out: // Stack/Queue // Dictionary (an implementation of a hash map) // HashSet // Read-only Collections - // Tuple (.Net 4+) + // Tuple (.NET 4+) /////////////////////////////////////// // Operators @@ -222,20 +222,20 @@ on a new line! ""Wow!"", the masses cried"; | Bitwise inclusive OR */ - // Incrementations + // Incrementing int i = 0; - Console.WriteLine("\n->Inc/Dec-rementation"); - Console.WriteLine(i++); //Prints "0", i = 1. Post-Incrementation - Console.WriteLine(++i); //Prints "2", i = 2. Pre-Incrementation - Console.WriteLine(i--); //Prints "2", i = 1. Post-Decrementation - Console.WriteLine(--i); //Prints "0", i = 0. Pre-Decrementation + Console.WriteLine("\n->Inc/Dec-rement"); + Console.WriteLine(i++); //Prints "0", i = 1. Post-Increment + Console.WriteLine(++i); //Prints "2", i = 2. Pre-Increment + Console.WriteLine(i--); //Prints "2", i = 1. Post-Decrement + Console.WriteLine(--i); //Prints "0", i = 0. Pre-Decrement /////////////////////////////////////// // Control Structures /////////////////////////////////////// Console.WriteLine("\n->Control Structures"); - // If statements are c-like + // If statements are C-like int j = 10; if (j == 10) { @@ -288,7 +288,7 @@ on a new line! ""Wow!"", the masses cried"; // For Each Loop // foreach loop structure => foreach(<iteratorType> <iteratorName> in <enumerable>) // The foreach loop loops over any object implementing IEnumerable or IEnumerable<T> - // All the collection types (Array, List, Dictionary...) in the .Net framework + // All the collection types (Array, List, Dictionary...) in the .NET framework // implement one or both of these interfaces. // (The ToCharArray() could be removed, because a string also implements IEnumerable) foreach (char character in "Hello World".ToCharArray()) @@ -297,7 +297,7 @@ on a new line! ""Wow!"", the masses cried"; } // Switch Case - // A switch works with the byte, short, char, and int data types. + // A switch works with byte, short, char, and int data types. // It also works with enumerated types (discussed in Enum Types), // the String class, and a few special classes that wrap // primitive types: Character, Byte, Short, and Integer. @@ -316,7 +316,7 @@ on a new line! ""Wow!"", the masses cried"; break; // You can assign more than one case to an action // But you can't add an action without a break before another case - // (if you want to do this, you would have to explicitly add a goto case x + // (if you want to do this, you would have to explicitly add a goto case x) case 6: case 7: case 8: @@ -337,14 +337,14 @@ on a new line! ""Wow!"", the masses cried"; // this will throw a FormatException on failure int.Parse("123"); // returns an integer version of "123" - // try parse will default to type default on failure - // in this case: 0 + // TryParse will default to the type's default value on failure + // in this case 0 int tryInt; if (int.TryParse("123", out tryInt)) // Function is boolean Console.WriteLine(tryInt); // 123 // Convert Integer To String - // Convert class has a number of methods to facilitate conversions + // The Convert class has a number of methods to facilitate conversions // String to int @@ -388,7 +388,7 @@ on a new line! ""Wow!"", the masses cried"; Console.Read(); } // End main method - // Available in C# 9 and later, this is basically a syntactic sugar for a class. Records are immutable*. + // Available in C# 9 and later, this is basically syntactic sugar for a class. Records are immutable*. public record ARecord(string Csharp); // CONSOLE ENTRY - A console application must have a main method as an entry point @@ -428,7 +428,7 @@ on a new line! ""Wow!"", the masses cried"; // GENERICS // The classes for TKey and TValue is specified by the user calling this function. - // This method emulates the SetDefault of Python + // This method emulates Python's dict.setdefault() public static TValue SetDefault<TKey, TValue>( IDictionary<TKey, TValue> dictionary, TKey key, diff --git a/es-es/ruby-es.html.markdown b/es-es/ruby-es.html.markdown index 63a47e89..8b703df1 100644 --- a/es-es/ruby-es.html.markdown +++ b/es-es/ruby-es.html.markdown @@ -89,10 +89,10 @@ true || false #=> true # Estos son usados como constructores controladores de flujo que encadenan # sentencias hasta que una de ellas retorne verdadero o falso -# `has_otra_cosa` solo se llama si `has_algo` retorna verdadero. -has_algo() and has_otra_cosa() -# `registra_error` solo se llama si `has_algo` falla -has_algo() or registra_error() +# `haz_otra_cosa` solo se llama si `haz_algo` retorna verdadero. +haz_algo() and haz_otra_cosa() +# `registra_error` solo se llama si `haz_algo` falla +haz_algo() or registra_error() # Los strings son objetos diff --git a/hjson.html.markdown b/hjson.html.markdown new file mode 100644 index 00000000..2abeca1a --- /dev/null +++ b/hjson.html.markdown @@ -0,0 +1,94 @@ +--- +language: Hjson +filename: learnhjson.hjson +contributors: + - ["MrTeferi", "https://github.com/MrTeferi"] +lang: en +--- + +Hjson is an attempt to make [JSON](https://learnxinyminutes.com/docs/json/) more human readable. + +Hjson is a syntax extension to JSON. +It's NOT a proposal to replace JSON or to incorporate it into the JSON spec itself. +It's intended to be used like a user interface for humans, +to read and edit before passing the JSON data to the machine. + +Let's take a look at examples to see the key syntax differences! + +```hjson +{ + # Comments are totally supported! + + // With forward slashes too! + + /* + Even block style comments, neat! + /* + + # Strings do not require quotes! + # Just keep it to a single line + human: readable + quotes: "are fine too" + + # Notice that commas are also not required! + # If using commas, strings DO require quotes! + object: { + name: Hjson + properties: [ + readable + exciting + fun + ] + with_commas: [ + "quoted", + "quoty", + "quote" + ] + details: ["this", "is", "fine", "too"] + } + + # Multiline quotes with proper whitespace handling are supported! + diary: + ''' + I wish JSON was more human readable. + If only there was a JSON for my needs! + Oh wait.. there is! It's called Hjson. + ''' + + # Backslashes are interpretted as an escape character ONLY in quoted strings + slash: This will not have a new line\n + slash-quoted: "This will definitely have a new line\n" + + # Make sure to use quotes when mixing whitespace with important punctuation + example1: "If, you're, going, to, comma in a string, use, quotes!" + example2: "Also if you want to use {} or [] or any JSON relevant punctuation!" + example3: [because, this, is, totally, BROKEN!] + example4: this is technically OK though: {}[],: + + # Enjoy working with Hjson! + party-time: { + Hjson-lovers: [ + me + my mom + "my dad" + ] + Hjson-power-level: 9000 + supported: { + python: yes + java: yes + javascript: yes + c++: yes + Go: yes + C#: yes + Rust: yes + } + partial-support: ["C", "Kotlin", "Ruby", "Rust"] + } + +} +``` + +## Further Reading + +* [Hjson.github.io](https://hjson.github.io/) Main Hjson site including editor support, how-to, etc. +* [Hjson Packages](https://github.com/hjson/) Various Hjson packages for different applications. diff --git a/powershell.html.markdown b/powershell.html.markdown index 318bf043..033d6c25 100644 --- a/powershell.html.markdown +++ b/powershell.html.markdown @@ -802,6 +802,6 @@ Interesting Projects * [Oh-My-Posh](https://github.com/JanDeDobbeleer/oh-my-posh) Shell customization similar to the popular Oh-My-Zsh on Mac * [PSake](https://github.com/psake/psake) Build automation tool * [Pester](https://github.com/pester/Pester) BDD Testing Framework -* [Jump-Location](https://github.com/tkellogg/Jump-Location) Powershell `cd` that reads your mind +* [ZLocation](https://github.com/vors/ZLocation) Powershell `cd` that reads your mind * [PowerShell Community Extensions](https://github.com/Pscx/Pscx) * [More on the Powershell Pipeline Issue](https://github.com/PowerShell/PowerShell/issues/1908) diff --git a/pt-br/tmux-pt.html.markdown b/pt-br/tmux-pt.html.markdown index ce3be407..e2130e0a 100644 --- a/pt-br/tmux-pt.html.markdown +++ b/pt-br/tmux-pt.html.markdown @@ -59,47 +59,49 @@ As seções tmux acopladas são controladas através de teclas de atalho. (prefi ---------------------------------------------------------------------- (C-b) = Ctrl + b # Abre a opção de receber comandos(atalhos). - (M-1) = Meta + 1 -or- Alt + 1 + (M-1) = Meta + 1 -ou- Alt + 1 ---------------------------------------------------------------------- - ? # Lista todos os comandos. - : # Acessa o prompt command do tmux - r # Força a reinicialização do cliente acoplado. - c # Cria uma nova janela. + ? # Lista todos os comandos. + : # Acessa o prompt command do tmux + r # Força a reinicialização do cliente acoplado. + c # Cria uma nova janela. - ! # Retira o painel atual da janela. - % # Divide o painel atual em dois. Esquerda e direita. - " # Divide o painel atual em dois. Para cima e para baixo. + ! # Retira o painel atual da janela. + % # Divide o painel atual em dois. Esquerda e direita. + " # Divide o painel atual em dois. Para cima e para baixo. - n # Muda para a próxima janela. - p # Muda para a janela anterior. - { # Troca o painel atual pelo anterior. - } # Troca o painel corrent pelo posterior. + n # Muda para a próxima janela. + p # Muda para a janela anterior. + { # Troca o painel atual pelo anterior. + } # Troca o painel corrent pelo posterior. + [ # Entra no modo cópia (Copy Mode) para copiar texto ou ver o histórico. - s # Seleciona uma nova seção para o cliente acoplado iterativamente. - w # Seleciona a janela atual iterativamente. - 0 to 9 # Seleciona a janela de 0 à 9. - d # Separa o cliente atual. - D # Seleciona um cliente a ser separado. + s # Seleciona uma nova seção para o cliente acoplado iterativamente. + w # Seleciona a janela atual iterativamente. + 0 to 9 # Seleciona a janela de 0 à 9. - & # Encerra a janela atual. - x # Encerra o painel atual. + d # Separa o cliente atual. + D # Seleciona um cliente a ser separado. - Up, Down # Move para o painel acima, abaixo, a esquerda ou a direita. + & # Encerra a janela atual. + x # Encerra o painel atual. + + Up, Down # Move para o painel acima, abaixo, a esquerda ou a direita. Left, Right - M-1 to M-5 # Organiza os paines: + M-1 to M-5 # Organiza os paines: # 1) Horizontalmente de maneira igual # 2) Verticalmente de maineira igual. # 3) Principal horizontalmente # 4) Principal verticamente. # 5) Mosaico - C-Up, C-Down # Altera o tamanho do painel atual em uma célula. + C-Up, C-Down # Altera o tamanho do painel atual em uma célula. C-Left, C-Right - M-Up, M-Down # Altera o tamanho do painel atual em cinco células. + M-Up, M-Down # Altera o tamanho do painel atual em cinco células. M-Left, M-Right ``` diff --git a/rdf.html.markdown b/rdf.html.markdown new file mode 100644 index 00000000..e99c9e50 --- /dev/null +++ b/rdf.html.markdown @@ -0,0 +1,161 @@ +--- +language: RDF +filename: learnrdf.ttl +contributors: +- ["Bob DuCharme", "http://bobdc.com/"] +lang: en-en +--- + +RDF (Resource Description Framework) is a [W3C +standard](https://www.w3.org/TR/2014/REC-rdf11-concepts-20140225/) data +model. The W3C has standardized several RDF syntaxes; examples below use the +most popular one, [Turtle](https://www.w3.org/TR/turtle/). + +One nice advantage of Turtle files is that if you concatenate any two +syntactically valid Turtle files, you will have another syntactically valid +Turtle file. This is one of many things about RDF that ease data integration. + +The W3C standard query language for RDF datasets is +[SPARQL](https://www.w3.org/TR/sparql11-query/). + +RDF expresses all facts as three-part {subject, predicate, object} statements +known as triples. Because the same entity can be the subject of some triples +and the object of others, a set of triples can represent a graph data +structure. A large-scale storage system for triples is called a triplestore, +and falls into the graph database category of NoSQL databases. + +RDF subjects and predicates must be URIs (Uniform Resource Identifiers), which +usually look like URLs but function as identifiers, not locators. The use of +URIs provides context for resource identifiers to make them unambiguous—for +example, to tell a book title from a job title. + +```turtle +# The hash symbol is the comment delimiter. + +# Turtle triple statements end with periods like natural language sentences. + +# These two triples tell us that the mythical Example Company's +# employee 134 has a hire date of 2022-11-12 and a family name of Smith: + +<http://example.com/emp134> <http://example.com/hireDate> "2022-11-12" . +<http://example.com/emp134> <http://example.com/familyName> "Smith" . + +# Declaring prefixes to stand in for namespaces reduces verbosity. These +# declarations typically go at the beginning of the file, but the only +# requirement is that they come before the first use of the prefix they declare. + +@prefix ex: <http://example.com/> . +ex:emp134 ex:hireDate "2022-11-12" . +ex:emp134 ex:familyName "Smith" . + +# A semicolon means that the next triple uses the same subject as the last +# one. This is handy for listing data about a single resource. The following +# example means the same thing as the previous one. + +@prefix ex: <http://example.com/> . +ex:emp134 ex:hireDate "2022-11-12" ; + ex:familyName "Smith" . + +# A comma means that the next triple has the same subject and predicate as +# the previous one. + +ex:emp134 ex:nickname "Smithy", "Skipper", "Big J". + +# Three single or double quote marks at the beginning and end of a value let +# you define a multi-line string value. + +ex:emp134 ex:description """ +Skipper joined the company in November. + +He always has a joke for everyone.""" . + +# Using URIs from existing standard vocabulary namespaces eases both data +# integration and interoperability with the large amount of RDF that already +# exists. Mixing and matching of standard and local custom namespaces is +# common. + +@prefix vcard: <http://www.w3.org/2006/vcard/ns#> . +ex:emp134 ex:hireDate "2022-11-12" ; + vcard:family-name "Smith" . + +# Related RDF standards provide vocabularies that are popular for basic +# facts. The rdfs:label predicate from the RDF Schema standard is a common +# way to indicate a human-readable name. + +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +ex:hireDate rdfs:label "hire date" . + +# String object values can include language codes, making +# multi-lingual representation of entities easier for applications +# reading the data (for example, when generating a user interface). + +ex:hireDate rdfs:label "hire date"@en, "date d'embauche"@fr . + +# Representing a triple's object with a URI (or prefixed name) is not required +# but lets you connect up triples into a graph. + +ex:emp134 vcard:family-name "Smith" . +ex:emp113 vcard:family-name "Jones" ; + ex:reportsTo ex:emp134 . + +# Objects can be datatypes from the XML Schema part 2 standard or your own +# custom datatypes. + +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . +ex:emp134 vcard:family-name "Smith"^^xsd:string ; # default data type + ex:hireDate "2022-11-12"^^xsd:date ; + ex:rating "3.5"^^ex:someCustomType . + +# The use of schemas with RDF is optional. Schemas may describe all or a +# subset of a dataset. They use a vocabulary described by the W3C RDF Schema +# (RDFS) standard, usually with a prefix of rdfs. + +# These schemas are descriptive, to ease the accommodation of new +# datasets, not proscriptive rules about how new data should be +# created. The following declares a class. (Note that RDFS is itself +# expressed in triples.) + +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +ex:Person rdf:type rdfs:Class . + +# The following triple means the same as the preceding one but +# uses a Turtle shortcut for terseness and more readability. + +ex:Person a rdfs:Class . + +# That last triple declares that ex:Person is an instance of a class, and the +# following declares that employee 113 is an instance of the class Employee. + +ex:emp113 a ex:Employee . + +# The first triple below is actually unnecessary because a typical +# RDFS processor will infer from the second one that ex:Employee is a +# class. (Only a subset of RDF parsers perform RDFS inferencing.) + +ex:Employee a rdfs:Class . +ex:Employee rdfs:subClassOf ex:Person . + +# An RDF parser that reads the last four triples shown and understands +# RDFS will infer that ex:emp113 is an instance of ex:Person, because +# it's an instance of ex:Employee, a subclass of ex:Person. + +# RDFS lets you declare properties and associate them with classes. +# Properties are first class resources and don't "belong" to classes +# in the object-oriented sense. rdfs:domain means "the following object +# class uses the property named by this triple's subject". rdfs:range +# means "the property named by this triple's subject will have a value of +# the following class or type". + +ex:birthday rdf:type rdf:Property ; + rdfs:domain ex:Person ; + rdfs:range xsd:date . + +``` + +## Further Reading + +* [RDF Primer — Turtle version](https://www.w3.org/2007/02/turtle/primer/) from the W3C +* [What is RDF?](https://www.bobdc.com/blog/whatisrdf/) on bobdc.com +* [What is RDFS?](https://www.bobdc.com/blog/whatisrdfs/) on bobdc.com +* [Introduction to RDF and SPARQL](https://data.europa.eu/sites/default/files/d2.1.2_training_module_1.3_introduction_to_rdf_sparql_en_edp.pdf) at data.europa.eu + diff --git a/zh-cn/gdscript-cn.html.markdown b/zh-cn/gdscript-cn.html.markdown index 3405bb8d..7c731533 100644 --- a/zh-cn/gdscript-cn.html.markdown +++ b/zh-cn/gdscript-cn.html.markdown @@ -111,6 +111,9 @@ func control_flow(): for i in range(20): # GDScript 有类似 Python 的 range 函数 print(i) # 所以这句将打印从 0 到 19 的数字 + for i in 20: # 与 Python 略有不同的是,你可以直接用一个整型数开始循环 + print(i) # 所以这行代码也将打印从 0 到 19 的数字 + for i in ["two", 3, 1.0]: # 遍历数组 print(i) diff --git a/zh-cn/powershell-cn.html.markdown b/zh-cn/powershell-cn.html.markdown index 6ab34e9f..875d2e33 100644 --- a/zh-cn/powershell-cn.html.markdown +++ b/zh-cn/powershell-cn.html.markdown @@ -13,7 +13,7 @@ PowerShell 是 Windows 平台下的脚本语言同时也是配置管理框架, 与 Bash 最大的不同是你大部分操作的东西是对象而不是普通的文本。 -[延伸阅读](https://technet.microsoft.com/en-us/library/bb978526.aspx) +[延伸阅读](https://docs.microsoft.com/zh-cn/powershell/scripting/overview) 如果你不确定你的环境,执行如下操作: @@ -263,7 +263,7 @@ Get-Command ConvertTo-*,ConvertFrom-* ### 有用的东西 # 更新 PATH -$env:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + +$env:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") # 找到 Python 的 PATH @@ -319,7 +319,7 @@ if (-not (Test-Path $Profile)) { 尚未涉及 -* WMI: Windows 管理规范 (Get-CimInstance) +* WMI: Windows 管理规范 (Get-CimInstance) * 多任务: Start-Job -scriptBlock {...}, * 代码签名 * 远程 (Enter-PSSession/Exit-PSSession; Invoke-Command) |