├── .gitattributes ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── build.yml │ └── lint.yml ├── .gitignore ├── .mailmap ├── CONTRIBUTING.md ├── LICENSE.txt ├── README.md ├── ada.md ├── amd.md ├── angularjs.md ├── ansible.md ├── apl.md ├── ar ├── html.md ├── python.md └── sql.md ├── arturo.md ├── asciidoc.md ├── assemblyscript.md ├── asymptotic-notation.md ├── ats.md ├── awk.md ├── ballerina.md ├── bash.md ├── bc.md ├── be └── python.md ├── bf.md ├── bg ├── logtalk.md └── perl.md ├── bqn.md ├── c++.md ├── c.md ├── ca ├── asciidoc.md ├── go.md ├── groovy.md ├── html.md └── kotlin.md ├── chapel.md ├── chicken.md ├── citron.md ├── clojure-macros.md ├── clojure.md ├── cmake.md ├── cobol.md ├── coffeescript.md ├── coldfusion.md ├── common-lisp.md ├── compojure.md ├── coq.md ├── crystal.md ├── cs ├── bf.md ├── css.md ├── elm.md ├── go.md ├── hack.md ├── javascript.md ├── json.md ├── markdown.md ├── python.md └── sass.md ├── csharp.md ├── css.md ├── csv.md ├── cue.md ├── cypher.md ├── d.md ├── da └── javascript.md ├── dart.md ├── de ├── asciidoc.md ├── bash.md ├── bc.md ├── bf.md ├── c++.md ├── c.md ├── clojure-macros.md ├── clojure.md ├── coffeescript.md ├── crystal.md ├── csharp.md ├── css.md ├── d.md ├── dhall.md ├── dynamic-programming.md ├── edn.md ├── elixir.md ├── elm.md ├── git.md ├── go.md ├── hack.md ├── haml.md ├── haskell.md ├── hq9+.md ├── html.md ├── java.md ├── javascript.md ├── json.md ├── latex.md ├── lolcode.md ├── lua.md ├── make.md ├── markdown.md ├── nix.md ├── opencv.md ├── paren.md ├── perl.md ├── processing.md ├── pug.md ├── pyqt.md ├── python.md ├── pythonlegacy.md ├── qt.md ├── rst.md ├── ruby-ecosystem.md ├── ruby.md ├── rust.md ├── sass.md ├── scala.md ├── shutit.md ├── sql.md ├── swift.md ├── tcl.md ├── vim.md ├── visualbasic.md └── yaml.md ├── dhall.md ├── directx9.md ├── docker.md ├── dynamic-programming.md ├── easylang.md ├── edn.md ├── el ├── bash.md ├── css.md ├── haskell.md ├── html.md ├── java.md ├── json.md ├── ocaml.md ├── python.md ├── racket.md ├── rust.md ├── scala.md └── vim.md ├── elisp.md ├── elixir.md ├── elm.md ├── emacs.md ├── erlang.md ├── es ├── amd.md ├── asciidoc.md ├── asymptotic-notation.md ├── awk.md ├── bash.md ├── bf.md ├── c++.md ├── c.md ├── chapel.md ├── clojure.md ├── coffeescript.md ├── coldfusion.md ├── common-lisp.md ├── csharp.md ├── css.md ├── curto.md ├── dart.md ├── docker.md ├── dynamic-programming.md ├── edn.md ├── elisp.md ├── elixir.md ├── factor.md ├── forth.md ├── fsharp.md ├── git.md ├── go.md ├── groovy.md ├── hack.md ├── haml.md ├── haskell.md ├── hq9+.md ├── html.md ├── hy.md ├── java.md ├── javascript.md ├── jquery.md ├── json.md ├── julia.md ├── kotlin.md ├── lambda-calculus.md ├── latex.md ├── less.md ├── livescript.md ├── logtalk.md ├── lua.md ├── make.md ├── markdown.md ├── matlab.md ├── objective-c.md ├── pascal.md ├── pcre.md ├── perl.md ├── php-composer.md ├── php.md ├── powershell.md ├── pyqt.md ├── python.md ├── pythonlegacy.md ├── pythonstatcomp.md ├── r.md ├── racket.md ├── raku.md ├── rst.md ├── ruby-ecosystem.md ├── ruby.md ├── rust.md ├── sass.md ├── scala.md ├── self.md ├── smallbasic.md ├── sql.md ├── swift.md ├── tcl.md ├── tmux.md ├── typescript.md ├── vim.md ├── visualbasic.md ├── wolfram.md ├── xml.md └── yaml.md ├── fa ├── bf.md ├── css.md ├── html.md ├── javascript.md └── vim.md ├── factor.md ├── fi ├── go.md ├── markdown.md └── ruby.md ├── fish.md ├── forth.md ├── fortran.md ├── fr ├── asymptotic-notation.md ├── awk.md ├── bash.md ├── bf.md ├── c++.md ├── c.md ├── clojure.md ├── coffeescript.md ├── crystal.md ├── csharp.md ├── css.md ├── d.md ├── dynamic-programming.md ├── elisp.md ├── elixir.md ├── erlang.md ├── fsharp.md ├── git.md ├── go.md ├── haml.md ├── haskell.md ├── html.md ├── hy.md ├── java.md ├── javascript.md ├── jquery.md ├── json.md ├── kotlin.md ├── lambda-calculus.md ├── livescript.md ├── lua.md ├── make.md ├── markdown.md ├── nix.md ├── objective-c.md ├── pcre.md ├── perl.md ├── php.md ├── pyqt.md ├── python.md ├── pythonlegacy.md ├── r.md ├── racket.md ├── ruby-ecosystem.md ├── ruby.md ├── rust.md ├── scala.md ├── set-theory.md ├── sql.md ├── tmux.md ├── typescript.md ├── vim.md ├── wolfram.md ├── xml.md └── yaml.md ├── fsharp.md ├── gdscript.md ├── git.md ├── gleam.md ├── go.md ├── golfscript.md ├── groovy.md ├── hack.md ├── haml.md ├── haskell.md ├── haxe.md ├── hcl.md ├── hdl.md ├── he ├── html.md └── uxntal.md ├── hi ├── amd.md ├── c++.md ├── d.md └── json.md ├── hjson.md ├── hocon.md ├── hq9+.md ├── hre.csv ├── html.md ├── httpie.md ├── hu ├── coffeescript.md ├── go.md ├── pythonlegacy.md ├── ruby.md ├── typescript.md └── yaml.md ├── hy.md ├── id ├── asciidoc.md ├── bf.md ├── coffeescript.md ├── css.md ├── hq9+.md ├── java.md ├── json.md ├── markdown.md ├── php.md ├── pyqt.md ├── rst.md ├── ruby.md ├── smallbasic.md └── xml.md ├── images ├── cairo │ ├── build.png │ ├── connect.png │ ├── connect2.png │ ├── declare.png │ └── deploy.png └── solidity │ ├── copy-address.png │ ├── metamask-kovan.png │ ├── remix-add-token.png │ ├── remix-choose-file.png │ ├── remix-compile.png │ ├── remix-deploy.png │ ├── remix-interact.png │ ├── remix-solidity.png │ ├── remix-testnet.png │ └── send-link.png ├── inform7.md ├── it ├── asciidoc.md ├── bash.md ├── bf.md ├── c++.md ├── c.md ├── cmake.md ├── coffeescript.md ├── dynamic-programming.md ├── elixir.md ├── fish.md ├── gdscript.md ├── git.md ├── go.md ├── html.md ├── java.md ├── javascript.md ├── jquery.md ├── json.md ├── logtalk.md ├── markdown.md ├── matlab.md ├── pcre.md ├── php-composer.md ├── pyqt.md ├── python.md ├── pythonlegacy.md ├── qt.md ├── rst.md ├── ruby-ecosystem.md ├── ruby.md ├── rust.md ├── solidity.md ├── sql.md ├── toml.md ├── typescript.md └── zfs.md ├── ja ├── asciidoc.md ├── bash.md ├── c.md ├── css.md ├── julia.md ├── markdown.md ├── nim.md ├── php.md ├── python.md ├── r.md ├── rust.md ├── vim.md └── yaml.md ├── janet.md ├── java.md ├── javascript.md ├── jinja.md ├── jq.md ├── jquery.md ├── json.md ├── jsonnet.md ├── julia.md ├── kdb+.md ├── ko ├── bash.md ├── bf.md ├── clojure-macros.md ├── clojure.md ├── coffeescript.md ├── common-lisp.md ├── erlang.md ├── go.md ├── java.md ├── javascript.md ├── json.md ├── kotlin.md ├── lua.md ├── markdown.md ├── php.md ├── pythonlegacy.md ├── racket.md ├── vim.md ├── xml.md └── yaml.md ├── kotlin.md ├── lambda-calculus.md ├── latex.md ├── lbstanza.md ├── ldpl.md ├── lean4.md ├── less.md ├── lfe.md ├── linker.md ├── lint ├── encoding.sh ├── frontmatter.py └── requirements.txt ├── livescript.md ├── logtalk.md ├── lolcode.md ├── lt ├── json.md └── tmux.md ├── lua.md ├── m.md ├── make.md ├── markdown.md ├── matlab.md ├── mercurial.md ├── mercury.md ├── messagepack.md ├── miniscript.md ├── mips.md ├── mongodb.md ├── moonscript.md ├── ms ├── bash.md ├── clojure-macros.md ├── clojure.md ├── coffeescript.md ├── common-lisp.md ├── elisp.md ├── javascript.md ├── json.md ├── sass.md └── xml.md ├── nim.md ├── niva.md ├── nix.md ├── nl ├── amd.md ├── bash.md ├── bf.md ├── coffeescript.md ├── dynamic-programming.md ├── html.md ├── json.md ├── markdown.md ├── typescript.md ├── vim.md ├── xml.md └── yaml.md ├── nmap.md ├── no ├── bash.md └── json.md ├── objective-c.md ├── ocaml.md ├── opencv.md ├── opengl.md ├── openmp.md ├── openscad.md ├── osl.md ├── p5.md ├── paren.md ├── pascal.md ├── pcre.md ├── perl.md ├── pets.csv ├── phel.md ├── phix.md ├── php-composer.md ├── php.md ├── pl ├── bf.md ├── haskell.md ├── java.md ├── json.md ├── perl.md ├── pythonlegacy.md ├── ruby.md ├── vim.md └── xml.md ├── powershell.md ├── processing.md ├── prolog.md ├── protocol-buffer-3.md ├── pt-br ├── amd.md ├── asciidoc.md ├── asymptotic-notation.md ├── awk.md ├── bash.md ├── bc.md ├── bf.md ├── c++.md ├── c.md ├── clojure-macros.md ├── clojure.md ├── cmake.md ├── coffeescript.md ├── common-lisp.md ├── csharp.md ├── css.md ├── cypher.md ├── d.md ├── dart.md ├── dynamic-programming.md ├── elisp.md ├── elixir.md ├── elm.md ├── emacs.md ├── erlang.md ├── factor.md ├── fsharp.md ├── git.md ├── go.md ├── groovy.md ├── hack.md ├── haskell.md ├── haxe.md ├── html.md ├── httpie.md ├── hy.md ├── java.md ├── javascript.md ├── jquery.md ├── json.md ├── julia.md ├── kotlin.md ├── lambda-calculus.md ├── latex.md ├── less.md ├── lua.md ├── make.md ├── markdown.md ├── matlab.md ├── p5.md ├── paren.md ├── pascal.md ├── perl.md ├── php-composer.md ├── php.md ├── processing.md ├── pug.md ├── pyqt.md ├── python.md ├── pythonlegacy.md ├── pythonstatcomp.md ├── qt.md ├── r.md ├── ruby-ecosystem.md ├── ruby.md ├── rust.md ├── sass.md ├── scala.md ├── self.md ├── set-theory.md ├── solidity.md ├── sql.md ├── stylus.md ├── swift.md ├── tmux.md ├── toml.md ├── typescript.md ├── vim.md ├── visualbasic.md ├── xml.md └── yaml.md ├── pt-pt ├── bf.md ├── git.md ├── kotlin.md ├── scala.md └── swift.md ├── pug.md ├── purescript.md ├── pyqt.md ├── python.md ├── pythonlegacy.md ├── pythonstatcomp.md ├── qml.md ├── qsharp.md ├── qt.md ├── r.md ├── racket.md ├── raku-pod.md ├── raku.md ├── raylib.md ├── rdf.md ├── reason.md ├── red.md ├── rescript.md ├── ro ├── bash.md ├── bf.md ├── clojure.md ├── coffeescript.md ├── elixir.md ├── haskell.md ├── json.md ├── latex.md ├── pythonlegacy.md ├── ruby.md └── xml.md ├── rst.md ├── ru ├── asymptotic-notation.md ├── bash.md ├── bf.md ├── c++.md ├── c.md ├── clojure.md ├── coffeescript.md ├── common-lisp.md ├── crystal.md ├── css.md ├── d.md ├── dynamic-programming.md ├── elixir.md ├── erlang.md ├── forth.md ├── go.md ├── haml.md ├── haskell.md ├── html.md ├── java.md ├── javascript.md ├── jquery.md ├── json.md ├── julia.md ├── kotlin.md ├── linker.md ├── lua.md ├── markdown.md ├── nim.md ├── objective-c.md ├── paren.md ├── pascal.md ├── perl.md ├── php-composer.md ├── php.md ├── pyqt.md ├── python.md ├── pythonlegacy.md ├── qt.md ├── ruby.md ├── rust.md ├── sql.md ├── swift.md ├── tcl.md ├── tmux.md ├── typescript.md ├── vim.md ├── visualbasic.md ├── xml.md ├── yaml.md └── zfs.md ├── ruby-ecosystem.md ├── ruby.md ├── rust.md ├── sass.md ├── scala.md ├── sed.md ├── self.md ├── set-theory.md ├── shutit.md ├── sing.md ├── sk ├── bash.md ├── coffeescript.md ├── elixir.md ├── git.md ├── json.md ├── latex.md └── ruby.md ├── sl └── asciidoc.md ├── smallbasic.md ├── smalltalk.md ├── solidity.md ├── sorbet.md ├── sql.md ├── standard-ml.md ├── stylus.md ├── sv ├── bf.md ├── haskell.md ├── json.md └── nix.md ├── swift.md ├── ta ├── css.md ├── javascript.md ├── json.md └── xml.md ├── tailspin.md ├── tcl.md ├── tcsh.md ├── texinfo.md ├── textile.md ├── th ├── pascal.md └── typescript.md ├── tmux.md ├── toml.md ├── tr ├── bf.md ├── c++.md ├── c.md ├── clojure.md ├── csharp.md ├── css.md ├── dynamic-programming.md ├── edn.md ├── fsharp.md ├── gdscript.md ├── git.md ├── html.md ├── javascript.md ├── jquery.md ├── kotlin.md ├── markdown.md ├── objective-c.md ├── php.md ├── python.md ├── pythonlegacy.md ├── ruby.md ├── sql.md ├── swift.md └── typescript.md ├── typescript.md ├── uk ├── awk.md ├── bash.md ├── c.md ├── cypher.md ├── go.md ├── java.md ├── javascript.md ├── json.md ├── kotlin.md ├── mips.md ├── pythonlegacy.md ├── ruby.md ├── rust.md ├── typescript.md └── wasm.md ├── uxntal.md ├── v.md ├── vala.md ├── vi ├── git.md ├── html.md ├── json.md ├── less.md ├── markdown.md ├── objective-c.md ├── python.md ├── ruby-ecosystem.md ├── ruby.md ├── sass.md ├── typescript.md └── xml.md ├── vim.md ├── vimscript.md ├── visualbasic.md ├── wasm.md ├── wikitext.md ├── wolfram.md ├── xml.md ├── yaml.md ├── zfs.md ├── zh-cn ├── angularjs.md ├── asciidoc.md ├── awk.md ├── bash.md ├── bc.md ├── bf.md ├── c++.md ├── c.md ├── clojure-macros.md ├── clojure.md ├── cmake.md ├── cobol.md ├── coffeescript.md ├── common-lisp.md ├── crystal.md ├── csharp.md ├── css.md ├── dart.md ├── docker.md ├── dynamic-programming.md ├── elisp.md ├── elixir.md ├── erlang.md ├── fortran.md ├── gdscript.md ├── git.md ├── go.md ├── groovy.md ├── haskell.md ├── html.md ├── java.md ├── javascript.md ├── jquery.md ├── json.md ├── julia.md ├── kotlin.md ├── lambda-calculus.md ├── latex.md ├── less.md ├── livescript.md ├── lua.md ├── make.md ├── markdown.md ├── matlab.md ├── mips.md ├── nim.md ├── nix.md ├── objective-c.md ├── opencv.md ├── perl.md ├── php.md ├── powershell.md ├── pyqt.md ├── python.md ├── pythonlegacy.md ├── qt.md ├── r.md ├── racket.md ├── raylib.md ├── red.md ├── ruby.md ├── rust.md ├── sass.md ├── scala.md ├── set-theory.md ├── solidity.md ├── sql.md ├── standard-ml.md ├── swift.md ├── tmux.md ├── typescript.md ├── vim.md ├── visualbasic.md ├── wolfram.md ├── xml.md ├── yaml.md └── zfs.md ├── zh-tw ├── bash.md ├── dart.md ├── elixir.md ├── javascript.md ├── pcre.md ├── perl.md ├── pythonlegacy.md └── typescript.md └── zig.md /.gitattributes: -------------------------------------------------------------------------------- 1 | *.md linguist-language=Markdown linguist-detectable 2 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | /fr-fr/ @vendethiel 2 | /ru-ru/ @Menelion 3 | /uk-ua/ @Menelion 4 | /zh-cn/ @geoffliu @imba-tjd 5 | /zh-tw/ @geoffliu @imba-tjd 6 | /ko-kr/ @justin-themedium 7 | /pt-pt/ @mribeirodantas 8 | /pt-br/ @mribeirodantas 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Is this a major issue that you cannot fix? 2 | 3 | **Being a community driven documents of languages and tools,"YOUR" contributions 4 | are also important. 5 | If the issue you're reporting is trivial to report to maintainers why not contribute 6 | to fix it. In that way, you will have contributed to an awesome open-source project. 7 | The changes can be typo fix, fixing of data in examples or grammar fix. If you found it, 8 | why not do it and take full credit for it?** 9 | 10 | Make sure the issue title is prepended with '[language/lang-code]' if the language is 11 | already on the site. 12 | If it's a request for a new language, use: '[Request] [language/lang-code]' 13 | 14 | Issues are always welcome. If you are able and willing, we welcome any pull requests 15 | as this is a community powered project. 16 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | - [ ] I solemnly swear that this is all original content of which I am the original author 2 | - [ ] Pull request title is prepended with `[language/lang-code]` (example `[python/fr]` for Python in French or `[java]` for multiple Java translations) 3 | - [ ] Pull request touches only one file (or a set of logically related files with similar changes made) 4 | - [ ] Content changes are aimed at *intermediate to experienced programmers* (this is a poor format for explaining fundamental programming concepts) 5 | - [ ] If you've changed any part of the YAML Frontmatter, make sure it is formatted according to [CONTRIBUTING.md](https://github.com/adambard/learnxinyminutes-docs/blob/master/CONTRIBUTING.md) 6 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Trigger site build 2 | 3 | on: 4 | push: 5 | branches: [main, master] 6 | 7 | jobs: 8 | deploy: 9 | runs-on: ubuntu-latest 10 | if: github.event_name == 'push' && github.repository_owner == 'adambard' 11 | steps: 12 | - name: Trigger site build 13 | uses: peter-evans/repository-dispatch@v3 14 | with: 15 | token: ${{ secrets.PAT_LEARNXINYMINUTES_SITE }} 16 | repository: adambard/learnxinyminutes-site 17 | event-type: doc-update 18 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: [master] 6 | pull_request: 7 | branches: [master] 8 | 9 | jobs: 10 | lint: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v4 14 | - uses: actions/setup-python@v5 15 | with: 16 | python-version: '3.13' 17 | - run: pip install -r lint/requirements.txt 18 | - uses: ruby/setup-ruby@v1 19 | with: 20 | ruby-version: '3.2' 21 | - run: gem install mdl 22 | 23 | - name: Files are UTF-8 24 | run: ./lint/encoding.sh . 25 | - name: "No non-breaking spaces" 26 | run: | 27 | if grep -rI --include='*.md' $'\u00A0' .; then 28 | exit 1 29 | fi 30 | - name: "No zero-width spaces" 31 | run: | 32 | if grep -rI --include='*.md' $'\u200B' .; then 33 | exit 1 34 | fi 35 | - name: "No carriage return" 36 | run: | 37 | if grep -rI --include='*.md' $'\u000D' .; then 38 | exit 1 39 | fi 40 | - name: "GitHub/JavaScript/TypeScript capitalized properly" 41 | run: | 42 | if grep -rI --include='*.md' -E "Github|Javascript|Typescript" .; then 43 | exit 1 44 | fi 45 | 46 | - name: Lint Markdown 47 | run: mdl . --ignore-front-matter -r MD003,MD005,MD011,MD018,MD019,MD023,MD025,MD027,MD028,MD030,MD035,MD037,MD038,MD039,MD046,MD047 48 | - name: Lint frontmatter 49 | run: ./lint/frontmatter.py . 50 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/*~ 2 | **/*# 3 | **/#*# 4 | **/*.swp 5 | **/*.swo 6 | **/*.bak 7 | **/*.log* 8 | **/*.sublime-workspace 9 | **/.DS_Store 10 | **/.DS_Store? 11 | **/._* 12 | **/.Spotlight-V100 13 | **/.Trashes 14 | **/ehthumbs.db 15 | **/Thumbs.db 16 | **/desktop.ini -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | Leigh Brenecki 2 | 3 | Adam Bard Adam 4 | Adam Bard Adam Bard 5 | 6 | ven Nami-Doc 7 | 8 | Andre Polykanine 9 | Andre Polykanine 10 | 11 | Divay Prakash 12 | Divay Prakash 13 | 14 | Levi Bostian 15 | 16 | Pratik Karki 17 | 18 | Marcel Ribeiro-Dantas 19 | Marcel Ribeiro-Dantas 20 | Marcel Ribeiro-Dantas 21 | Marcel Ribeiro-Dantas 22 | Marcel Ribeiro-Dantas 23 | 24 | Geoff Liu 25 | Geoff Liu 26 | 27 | sirkubax 28 | 29 | caminsha <31421093+caminsha@users.noreply.github.com> 30 | 31 | Samantha McVey 32 | 33 | Ian Bertolacci ian.bertolacci 34 | 35 | Boris Verkhovskiy 36 | 37 | Louie Dinh lodin 38 | 39 | Milo Gilad Milo Gilad 40 | 41 | Yannick Loriot Yannick 42 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [Learn X in Y minutes][1] 2 | 3 | Whirlwind tours of (several, hopefully many someday) popular and 4 | ought-to-be-more-popular programming languages, presented as valid, commented 5 | code and explained as they go. 6 | 7 | ## We need YOU!... 8 | 9 | ... to write more inline code tutorials. Just grab an existing file from this 10 | repo and copy the formatting (don't worry, it's all very simple). Make a new 11 | file, send a pull request, and if it passes muster I'll get it up pronto. 12 | Remember to fill in the "contributors" fields so you get credited properly! 13 | 14 | ## Contributing 15 | 16 | All contributions are welcome, from the tiniest typo to a brand new article. 17 | Translations in all languages are welcome (or, for that matter, original 18 | articles in any language). Send a pull request or open an issue any time of day 19 | or night. 20 | 21 | **Please prepend the tag `[language/lang-code]` to your issues and pull 22 | requests.** For example, `[python/en]` for English Python. This will help 23 | everyone pick out things they care about. 24 | 25 | We're happy for any contribution in any form, but if you're making more than one 26 | major change (i.e. translations for two different languages) it would be super 27 | cool of you to make a separate pull request for each one so that someone can 28 | review them more effectively and/or individually. 29 | 30 | For a detailed style guide, please review the full [CONTRIBUTING][2] guidelines. 31 | 32 | ## License 33 | 34 | Contributors retain copyright to their work, and can request removal at any 35 | time. By uploading a doc here, you agree to publish your work under the default 36 | [Creative Commons Attribution-ShareAlike 3.0 Unported][3] licensing included on 37 | each doc page. 38 | 39 | Anything not covered by the above -- basically, this README -- you can use as 40 | you wish, I guess. 41 | 42 | 43 | [1]: https://learnxinyminutes.com 44 | [2]: /CONTRIBUTING.md 45 | [3]: http://creativecommons.org/licenses/by-sa/3.0/deed.en_US 46 | -------------------------------------------------------------------------------- /apl.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: APL 3 | contributors: 4 | - ["nooodl", "https://github.com/nooodl"] 5 | filename: learnapl.apl 6 | --- 7 | 8 | ```apl 9 | ⍝ Comments in APL are prefixed by ⍝. 10 | 11 | ⍝ A list of numbers. (¯ is negative) 12 | 2 3e7 ¯4 50.3 13 | 14 | ⍝ An expression, showing some functions. In APL, there's 15 | ⍝ no order of operations: everything is parsed right-to- 16 | ⍝ left. This is equal to 5 + (4 × (2 ÷ (5 - 3))) = 9: 17 | 5 + 4 × 2 ÷ 5 - 3 ⍝ 9 18 | 19 | ⍝ These functions work on lists, too: 20 | 1 2 3 4 × 5 ⍝ 5 10 15 20 21 | 1 2 3 4 × 5 6 7 8 ⍝ 5 12 21 32 22 | 23 | ⍝ All functions have single-argument and dual-argument 24 | ⍝ meanings. For example, "×" applied to two arguments 25 | ⍝ means multiply, but when applied to only a right-hand 26 | ⍝ side, it returns the sign: 27 | 28 | × ¯4 ¯2 0 2 4 ⍝ ¯1 ¯1 0 1 1 29 | 30 | ⍝ Values can be compared using these operators (1 means 31 | ⍝ "true", 0 means "false"): 32 | 33 | 10 20 30 = 10 20 99 ⍝ 1 1 0 34 | 35 | 10 20 30 < 10 20 99 ⍝ 0 0 1 36 | 37 | ⍝ "⍳n" returns a vector containing the first n naturals. 38 | ⍝ Matrices can be constructed using ⍴ (reshape): 39 | 4 3 ⍴ ⍳5 ⍝ 0 1 2 40 | ⍝ 3 4 0 41 | ⍝ 1 2 3 42 | ⍝ 4 0 1 43 | 44 | ⍝ Single-argument ⍴ gives you the dimensions back: 45 | ⍴ 4 3 ⍴ ⍳5 ⍝ 4 3 46 | 47 | ⍝ Values can be stored using ←. Let's calculate the mean 48 | ⍝ value of a vector of numbers: 49 | A ← 10 60 55 23 50 | 51 | ⍝ Sum of elements of A (/ is reduce): 52 | +/A ⍝ 148 53 | 54 | ⍝ Length of A: 55 | ⍴A ⍝ 4 56 | 57 | ⍝ Mean: 58 | (+/A) ÷ (⍴A) ⍝ 37 59 | 60 | ⍝ We can define this as a function using {} and ⍵: 61 | mean ← {(+/⍵)÷⍴⍵} 62 | mean A ⍝ 37 63 | ``` 64 | 65 | ## Further Reading 66 | 67 | - [APL Wiki](https://aplwiki.com/) 68 | - An older version of APL book by the creator: [Kenneth Iverson - A Programming Language](https://www.softwarepreservation.org/projects/apl/Books/APROGRAMMING%20LANGUAGE/view) 69 | - Additional Books: [APL Books](https://aplwiki.com/wiki/Books) 70 | -------------------------------------------------------------------------------- /asciidoc.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: AsciiDoc 3 | contributors: 4 | - ["Ryan Mavilia", "http://unoriginality.rocks/"] 5 | - ["Abel Salgado Romero", "https://twitter.com/abelsromero"] 6 | filename: asciidoc.adoc 7 | --- 8 | 9 | AsciiDoc is a markup language similar to Markdown and it can be used for anything from books to blogs. Created in 2002 by Stuart Rackham the language is simple but it allows for a great amount of customization. 10 | 11 | Document Header 12 | 13 | Headers are optional and can't contain blank lines. It must be offset from content by at least one blank line. 14 | 15 | Title Only 16 | 17 | ``` 18 | = Document Title 19 | 20 | First sentence of document. 21 | ``` 22 | 23 | Title and Author 24 | 25 | ``` 26 | = Document Title 27 | First Last 28 | 29 | Start of this document. 30 | ``` 31 | 32 | Multiple Authors 33 | 34 | ``` 35 | = Document Title 36 | John Doe ; Jane Doe; Black Beard 37 | 38 | Start of a doc with multiple authors. 39 | ``` 40 | 41 | Revision Line (requires an author line) 42 | 43 | ``` 44 | = Doc Title V1 45 | Potato Man 46 | v1.0, 2016-01-13 47 | 48 | This article about chips is going to be fun. 49 | ``` 50 | 51 | Paragraphs 52 | 53 | ``` 54 | You don't need anything special for paragraphs. 55 | 56 | Add a blank line between paragraphs to separate them. 57 | 58 | To create a line blank add a + 59 | and you will receive a line break! 60 | ``` 61 | 62 | Formatting Text 63 | 64 | ``` 65 | _underscore creates italics_ 66 | *asterisks for bold* 67 | *_combine for extra fun_* 68 | `use ticks to signify monospace` 69 | `*bolded monospace*` 70 | ``` 71 | 72 | Section Titles 73 | 74 | ``` 75 | = Level 0 (may only be used in document's header) 76 | 77 | == Level 1

78 | 79 | === Level 2

80 | 81 | ==== Level 3

82 | 83 | ===== Level 4

84 | ``` 85 | 86 | Lists 87 | 88 | To create a bulleted list use asterisks. 89 | 90 | ``` 91 | * foo 92 | * bar 93 | * baz 94 | ``` 95 | 96 | To create a numbered list use periods. 97 | 98 | ``` 99 | . item 1 100 | . item 2 101 | . item 3 102 | ``` 103 | 104 | You can nest lists by adding extra asterisks or periods up to five times. 105 | 106 | ``` 107 | * foo 1 108 | ** foo 2 109 | *** foo 3 110 | **** foo 4 111 | ***** foo 5 112 | 113 | . foo 1 114 | .. foo 2 115 | ... foo 3 116 | .... foo 4 117 | ..... foo 5 118 | ``` 119 | 120 | ## Further Reading 121 | 122 | There are two tools to process AsciiDoc documents: 123 | 124 | 1. [AsciiDoc](http://asciidoc.org/): original Python implementation available in the main Linux distributions. Stable and currently in maintenance mode. 125 | 2. [Asciidoctor](http://asciidoctor.org/): alternative Ruby implementation, usable also from Java and JavaScript. Under active development, it aims to extend the AsciiDoc syntax with new features and output formats. 126 | 127 | Following links are related to `Asciidoctor` implementation: 128 | 129 | * [Markdown - AsciiDoc syntax comparison](http://asciidoctor.org/docs/user-manual/#comparison-by-example): side-by-side comparison of common Markdown and AsciiDoc elements. 130 | * [Getting started](http://asciidoctor.org/docs/#get-started-with-asciidoctor): installation and quick start guides to render simple documents. 131 | * [Asciidoctor User Manual](http://asciidoctor.org/docs/user-manual/): complete single-document manual with syntax reference, examples, rendering tools, amongst others. 132 | -------------------------------------------------------------------------------- /bc.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: bc 3 | contributors: 4 | - ["Btup"] 5 | filename: learnbc.bc 6 | --- 7 | ```bc 8 | /*This is a multi- 9 | line comment.*/ 10 | # This is also a (one-line) comment! (in GNU bc). 11 | 12 | /*1. Variables and control structures*/ 13 | num = 45 /*All variables save only doubles, and you cannot save 14 | string constants directly.*/ 15 | num = 45; /*You can choose to add a semicolon after 16 | every statement. This is optional.*/ 17 | /*Blocks are denoted using the {} operators(similar to C):*/ 18 | while(num < 50) { 19 | num += 1 /*equivalent to num=num+1. 20 | a = a op b is equivalent to a op= b.*/ 21 | } 22 | /*And there are ++(increment) and --(decrement) operators.*/ 23 | /*There are 3 special variables: 24 | scale: defines the scale of the double numbers. 25 | ibase: defines the base of input. 26 | obase: defines the base of output.*/ 27 | /*If clauses:*/ 28 | hour = read() /*Input a number*/ 29 | 30 | if(hour < 12) { /*Operators are exactly like C.*/ 31 | print "Good morning\n" /*"print" outputs strings or variables 32 | separated by commas.*/ 33 | } else if(hour == 12) { 34 | print "Hello\n" 35 | /*Escaping sequences start with a \ in a string. 36 | In order to make the escaping sequences clearer, here 37 | is a simplified list of them that will work in bc: 38 | \b: backspace 39 | \c: carriage return 40 | \n: newline 41 | \t: tab 42 | \\: backslash*/ 43 | } else { 44 | print "Good afternoon\n" 45 | } 46 | 47 | /*Like C, only 0 is falsy.*/ 48 | num = 0 49 | if(!num) {print "false\n"} 50 | 51 | /*Unlike C, bc does not have the ?: operators. For example, 52 | this block of code will cause an error: 53 | a = (num) ? 1 : 0 54 | However, you can simulate one:*/ 55 | a = (num) && (1) || (0) /*&& is and, || is or*/ 56 | 57 | /*For loops*/ 58 | num = 0 59 | for(i = 1; i <= 100; i++) {/*Similar to the C for loop.*/ 60 | num += i 61 | } 62 | 63 | /*2.Functions and Arrays*/ 64 | define fac(n) { /*define a function using define.*/ 65 | if(n == 1 || n == 0) { 66 | return 1 /*return a value*/ 67 | } 68 | return n * fac(n - 1) /*recursion is possible*/ 69 | } 70 | 71 | /*Closures and anonymous functions are impossible.*/ 72 | 73 | num = fac(4) /*24*/ 74 | 75 | /*This is an example of local variables:*/ 76 | define x(n) { 77 | auto x 78 | x = 1 79 | return n + x 80 | } 81 | x(3) /*4*/ 82 | print x /*It turns out that x is not accessible out of the function.*/ 83 | /*Arrays are equivalent to the C array.*/ 84 | for(i = 0; i <= 3; i++) { 85 | a[i] = 1 86 | } 87 | /*Access it like this:*/ 88 | print a[0], " ", a[1], " ", a[2], " ", a[3], "\n" 89 | quit /*Add this line of code to make sure 90 | that your program exits. This line of code is optional.*/ 91 | ``` 92 | 93 | Enjoy this simple calculator! (Or this programming language, to be exact.) 94 | 95 | This whole program is written in GNU bc. To run it, use ```bc learnbc.bc```. 96 | -------------------------------------------------------------------------------- /coffeescript.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: CoffeeScript 3 | contributors: 4 | - ["Tenor Biel", "http://github.com/L8D"] 5 | - ["Xavier Yao", "http://github.com/xavieryao"] 6 | filename: coffeescript.coffee 7 | --- 8 | 9 | CoffeeScript is a little language that compiles one-to-one into the equivalent 10 | JavaScript, and there is no interpretation at runtime. As one of the successors 11 | to JavaScript, CoffeeScript tries its best to output readable, pretty-printed 12 | and smooth-running JavaScript code, which works well in every JavaScript runtime. 13 | It also attempts to try and make JavaScript more in line with the trends of many 14 | modern languages. 15 | 16 | See also [the CoffeeScript website](http://coffeescript.org/), which has a complete tutorial on CoffeeScript. 17 | 18 | ```coffeescript 19 | # Comments are similar to Ruby and Python, using the hash symbol `#` 20 | 21 | ### 22 | Block comments are like these, and they translate directly to '/ *'s and '* /'s 23 | for the resulting JavaScript code. 24 | 25 | You should understand most of JavaScript semantics 26 | before continuing. 27 | ### 28 | 29 | # Assignment: 30 | number = 42 #=> var number = 42; 31 | opposite = true #=> var opposite = true; 32 | 33 | # Conditions: 34 | number = -42 if opposite #=> if(opposite) { number = -42; } 35 | 36 | # Functions: 37 | square = (x) -> x * x #=> var square = function(x) { return x * x; } 38 | 39 | fill = (container, liquid = "coffee") -> 40 | "Filling the #{container} with #{liquid}..." 41 | #=>var fill; 42 | # 43 | #fill = function(container, liquid) { 44 | # if (liquid == null) { 45 | # liquid = "coffee"; 46 | # } 47 | # return "Filling the " + container + " with " + liquid + "..."; 48 | #}; 49 | 50 | # Ranges: 51 | list = [1..5] #=> var list = [1, 2, 3, 4, 5]; 52 | 53 | # Objects: 54 | math = 55 | root: Math.sqrt 56 | square: square 57 | cube: (x) -> x * square x 58 | #=> var math = { 59 | # "root": Math.sqrt, 60 | # "square": square, 61 | # "cube": function(x) { return x * square(x); } 62 | # }; 63 | 64 | # Splats: 65 | race = (winner, runners...) -> 66 | print winner, runners 67 | #=>race = function() { 68 | # var runners, winner; 69 | # winner = arguments[0], runners = 2 <= arguments.length ? __slice.call(arguments, 1) : []; 70 | # return print(winner, runners); 71 | # }; 72 | 73 | # Existence: 74 | alert "I knew it!" if elvis? 75 | #=> if(typeof elvis !== "undefined" && elvis !== null) { alert("I knew it!"); } 76 | 77 | # Array comprehensions: 78 | cubes = (math.cube num for num in list) 79 | #=>cubes = (function() { 80 | # var _i, _len, _results; 81 | # _results = []; 82 | # for (_i = 0, _len = list.length; _i < _len; _i++) { 83 | # num = list[_i]; 84 | # _results.push(math.cube(num)); 85 | # } 86 | # return _results; 87 | # })(); 88 | 89 | foods = ['broccoli', 'spinach', 'chocolate'] 90 | eat food for food in foods when food isnt 'chocolate' 91 | #=>foods = ['broccoli', 'spinach', 'chocolate']; 92 | # 93 | #for (_k = 0, _len2 = foods.length; _k < _len2; _k++) { 94 | # food = foods[_k]; 95 | # if (food !== 'chocolate') { 96 | # eat(food); 97 | # } 98 | #} 99 | ``` 100 | 101 | ## Additional resources 102 | 103 | - [Smooth CoffeeScript](http://autotelicum.github.io/Smooth-CoffeeScript/) 104 | - [CoffeeScript Ristretto](https://leanpub.com/coffeescript-ristretto/read) 105 | -------------------------------------------------------------------------------- /cs/json.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Anna Harren", "https://github.com/iirelu"] 4 | - ["Marco Scannadinari", "https://github.com/marcoms"] 5 | translators: 6 | - ["Vojta Svoboda", "https://github.com/vojtasvoboda/"] 7 | --- 8 | 9 | JSON je exterémně jednoduchý datově nezávislý formát a bude asi jeden z 10 | nejjednodušších 'Learn X in Y Minutes' ze všech. 11 | 12 | JSON nemá ve své nejzákladnější podobě žádné komentáře, ale většina parserů 13 | umí pracovat s komentáři ve stylu jazyka C (`//`, `/* */`). Pro tyto účely 14 | však budeme používat 100% validní JSON bez komentářů. Pojďme se podívat na 15 | syntaxi formátu JSON: 16 | 17 | ```json 18 | { 19 | "klic": "value", 20 | 21 | "hodnoty": "Musí být vždy uvozený v dvojitých uvozovkách", 22 | "cisla": 0, 23 | "retezce": "Hellø, wørld. Všechny unicode znaky jsou povolené, společně s \"escapováním\".", 24 | "pravdivostni_hodnota": true, 25 | "prazdna_hodnota": null, 26 | 27 | "velke_cislo": 1.2e+100, 28 | 29 | "objekt": { 30 | "komentar": "Most of your structure will come from objects.", 31 | 32 | "pole": [0, 1, 2, 3, "Pole nemusí být pouze homogenní.", 5], 33 | 34 | "jiny_objekt": { 35 | "comment": "Je povolené jakkoli hluboké zanoření." 36 | } 37 | }, 38 | 39 | "cokoli": [ 40 | { 41 | "zdroje_drasliku": ["banány"] 42 | }, 43 | [ 44 | [1, 0, 0, 0], 45 | [0, 1, 0, 0], 46 | [0, 0, 1, "neo"], 47 | [0, 0, 0, 1] 48 | ] 49 | ], 50 | 51 | "alternativni_styl_zapisu": { 52 | "komentar": "Mrkni se na toto!" 53 | , "pozice_carky": "Na pozici čárky nezáleží - pokud je před hodnotou, ať už je kdekoli, tak je validní." 54 | , "dalsi_komentar": "To je skvělé." 55 | }, 56 | 57 | "to_bylo_rychle": "A tím jsme hotový. Nyní již víte vše, co může formát JSON nabídnout!" 58 | } 59 | ``` 60 | -------------------------------------------------------------------------------- /de/asciidoc.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Ryan Mavilia", "http://unoriginality.rocks/"] 4 | translators: 5 | - ["Dennis Keller", "https://github.com/denniskeller"] 6 | --- 7 | 8 | AsciiDoc ist eine Auszeichnungssprache, ähnlich wie Markdown. Sie kann für alles 9 | verwendet werden von Büchern bis zu Blogs. Erfunden wurde sie 2002 von Stuart 10 | Rackham. Die Sprache ist simpel, aber sie ermöglicht eine große Anzahl an 11 | Anpassungen. 12 | 13 | Kopfzeile des Dokuments 14 | 15 | Kopfzeilen sind optional und dürfen keine Leerzeilen besitzen. Sie müssen 16 | mindestens eine Leerzeile vom Inhalt versetzt sein. 17 | 18 | Nur Titel 19 | 20 | ``` 21 | = Dokumententitel 22 | 23 | Erster Satz des Dokuments. 24 | ``` 25 | 26 | Titel und Autor 27 | 28 | ``` 29 | = Dokumententitel 30 | Vorname Nachname 31 | 32 | Start des Dokuments. 33 | ``` 34 | 35 | Mehrere Autoren 36 | 37 | ``` 38 | = Dokumententitel 39 | John Doe ; Jane Doe; Black Beard 40 | 41 | Starte ein Dokument mit mehreren Autoren. 42 | ``` 43 | 44 | Revisionszeile (benötigt eine Autorzeile) 45 | 46 | ``` 47 | = Dokumententitel V1 48 | Potato Man 49 | v1.0, 2016-01-13 50 | 51 | Dieser Artikel über Chips wird Spaß machen. 52 | ``` 53 | 54 | Absätze 55 | 56 | ``` 57 | Du musst nichts Besonderes machen für Absätze. 58 | 59 | Füge eine Leerzeile zwischen zwei Absätze, um sie zu trennen. 60 | 61 | Um eine Leerzeile zu erhalten musst du ein + 62 | ergänzen und du erhältst einen Umbruch! 63 | ``` 64 | 65 | Textformatierung 66 | 67 | ``` 68 | _Unterstriche erstellt Kursivschrift_ 69 | *Sternchen für Fett gedruckt* 70 | *_Kombinieren für extra Spaß_* 71 | `Benutze Ticks um Monospace zu signalisieren` 72 | `*Fett gedruckter Monospace*` 73 | ``` 74 | 75 | Abteilungstitel 76 | 77 | ``` 78 | = Level 0 (sollte nur in der Kopfzeile verwendet werden) 79 | 80 | == Level 1

81 | 82 | === Level 2

83 | 84 | ==== Level 3

85 | 86 | ===== Level 4

87 | ``` 88 | 89 | Listen 90 | 91 | Um eine Aufzählung zu erstellen, verwendest du Sternchen. 92 | 93 | ``` 94 | * foo 95 | * bar 96 | * baz 97 | ``` 98 | 99 | Um eine nummerierte Liste zu erstellen, verwendest du Punkte. 100 | 101 | ``` 102 | . item 1 103 | . item 2 104 | . item 3 105 | ``` 106 | 107 | Um Listen zu verschachteln, musst du zusätzliche Sternchen beziehungsweise 108 | Punkte hinzufügen. Dies ist bis zu fünf Mal möglich. 109 | 110 | ``` 111 | * foo 1 112 | ** foo 2 113 | *** foo 3 114 | **** foo 4 115 | ***** foo 5 116 | 117 | . foo 1 118 | .. foo 2 119 | ... foo 3 120 | .... foo 4 121 | ..... foo 5 122 | ``` 123 | -------------------------------------------------------------------------------- /de/bc.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["caminsha", "https://github.com/caminsha"] 4 | --- 5 | 6 | ```bc 7 | /* Das ist ein mehr- 8 | zeiliger Kommentar */ 9 | # Das ist ein (einzeiliger) Kommentar (in GNU bc). 10 | 11 | /*1. Variablen und Kontrollstrukturen*/ 12 | num = 45 /* Alle Variablen speichern nur Doubles und es ist 13 | nicht möglich String-Konstanten direkt zu speichern */ 14 | num = 45; /* Es kann nach jedem Statement ein optionales Semikolon 15 | hinzugefügt werden */ 16 | /* Blöcke werden mit den Operatoren {} (ähnlich wie in C) bezeichnet */ 17 | while(num < 50) { 18 | num += 1 /* äquivalent zu num=num+1. 19 | a = a Op b ist äquivalent zu a Op= b*/ 20 | } 21 | /* Ausserdem gibt es ++ (Inkrement) und -- (Dekrement) Operatoren */ 22 | /* Es gibt 3 spezielle Variablen: 23 | scale: definiert die Anzahl Nachkommastellen 24 | ibase: definiert die Basis der Eingabe 25 | obase: definiert die Basis der Ausgabe*/ 26 | /*Wenn-Bedingungen:*/ 27 | hour = read() /*Eingabe einer Zahl*/ 28 | 29 | if(hour < 12) { /*Operatoren sind genau wie in C*/ 30 | print "Guten Morgen\n" /*"print" Gibt Strings oder Variablen 31 | mit einem Komma separiert aus.*/ 32 | } else if(hour == 12) { 33 | print "Hallo\n" 34 | /* Escape-Sequenzen starten mit einem \ in einem String. 35 | Um Escape-Sequenzen klarer zu machen, ist hier eine vereinfachte 36 | Liste, welche in bc funktionieren: 37 | \b: Backspace 38 | \c: carriage return 39 | \n: Zeilenumbruch 40 | \t: Tab 41 | \\: Backslash*/ 42 | } else { 43 | /* Standardmässig sind Variablen global. */ 44 | thisIsGlobal = 5 45 | /*Variablen können lokal gemacht werden. Benutze das Schlüsselwort "auto" 46 | in einer Funktion.*/ 47 | } 48 | 49 | /* Jede Variable hat als Voreinstellung den Wert 0. */ 50 | num = blankVariable /*num wurde auf 0 gesetzt.*/ 51 | 52 | /*Wie in C ist nur 0 falsch.*/ 53 | if(!num) {print "false\n"} 54 | 55 | /*Im Gegensatz zu C hat bc den Ternäroperator ?: nicht. Zum Beispiel 56 | führt dieser Codeblock zu einem Fehler: 57 | a = (num) ? 1 : 0 58 | Jedoch kann dies simuliert werden:*/ 59 | a = (num) && (1) || (0) /*&& ist das UND, || ist das ODER*/ 60 | 61 | /*For-Schleifen*/ 62 | num = 0 63 | for(i = 1; i <= 100; i++) {/*Gleich wie die For-Schleife in C*/ 64 | num += i 65 | } 66 | 67 | /*2.Funktionen und Arrays*/ 68 | define fac(n) { /*Definiere eine Funktion mit define*/ 69 | if(n == 1 || n == 0) { 70 | return 1 /*Gebe einen Wert zurück*/ 71 | } 72 | return n * fac(n - 1) /*Rekursion ist möglich*/ 73 | } 74 | 75 | /*Closures und anonyme Funktionen sind nicht möglich */ 76 | 77 | num = fac(4) /*24*/ 78 | 79 | /*Dies ist ein Beispiel von lokalen Variablen.*/ 80 | define x(n) { 81 | auto x 82 | x = 1 83 | return n + x 84 | } 85 | x(3) /*4*/ 86 | print x /*Es stellt sich heraus, dass x ausserhalb der Funktion nicht 87 | zugänglich ist.*/ 88 | /*Arrays sind äquivalent zu C Arrays.*/ 89 | for(i = 0; i <= 3; i++) { 90 | a[i] = 1 91 | } 92 | /*Greife wie folgt darauf zu:*/ 93 | print a[0], " ", a[1], " ", a[2], " ", a[3], "\n" 94 | quit /* Füge diese Codezeile hinzu, um sicherzustellen, dass 95 | das Programm beendet. Diese Codezeile ist optional.*/ 96 | ``` 97 | 98 | Viel Spass mit diesem einfachen Rechner! (Oder dieser Programmiersprache, um exakt zu sein.) 99 | 100 | Das ganze Programm wurde in GNU bc geschrieben. Um es auszuführen, benutze ```bc learnbc.bc```. 101 | -------------------------------------------------------------------------------- /de/coffeescript.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Tenor Biel", "http://github.com/L8D"] 4 | - ["Xavier Yao", "http://github.com/xavieryao"] 5 | translators: 6 | - ["Frederik Ring", "https://github.com/m90"] 7 | - ["Philipp Fischbeck", "https://github.com/PFischbeck"] 8 | --- 9 | 10 | CoffeeScript ist eine kleine Sprache, die eins zu eins nach JavaScript übersetzt wird - es findet keine Interpretation zur Laufzeit statt. 11 | Als Nachfolger von JavaScript konzipiert, gibt CoffeeScript sein Bestes, lesbaren, gut formatierten und sauber laufenden JavaScript-Code zu erzeugen, der in jeder JavaScript-Laufzeit einwandfrei funktioniert. 12 | 13 | Auf [der CoffeeScript Website](http://coffeescript.org/) gibt es ein ausführliches Tutorial. 14 | 15 | ``` coffeescript 16 | # CoffeeScript ist eine dieser Sprachen für "Hipster" 17 | # und folgt daher vielen Trends und Einflüssen aus modernen Sprachen. 18 | # Kommentare werden daher wie in Ruby und Python mit Hashes gekennzeichnet 19 | 20 | ### 21 | Kommentarblöcke sehen aus wie diese und werden direkt nach '/ *'s und '* /'s 22 | im erzeugten JavaScript umgewandelt. 23 | 24 | Vorweg: bevor du mit CoffeeScript anfängst, solltest du bereits einen guten 25 | Überblick über die Sprache JavaScript haben. 26 | ### 27 | 28 | # Zuweisung: 29 | number = 42 #=> var number = 42; 30 | opposite = true #=> var opposite = true; 31 | 32 | # Bedingungen: 33 | number = -42 if opposite #=> if(opposite) { number = -42; } 34 | 35 | # Funktionen: 36 | square = (x) -> x * x #=> var square = function(x) { return x * x; } 37 | 38 | fill = (container, liquid = "Kaffee") -> 39 | "#{container} wird mit #{liquid} gefüllt..." 40 | #=>var fill; 41 | # 42 | #fill = function(container, liquid) { 43 | # if (liquid == null) { 44 | # liquid = "Kaffee"; 45 | # } 46 | # return container + " wird mit " + liquid + " gefüllt..."; 47 | #}; 48 | 49 | # "Ranges": 50 | list = [1..5] #=> var list = [1, 2, 3, 4, 5]; 51 | 52 | # Objekte: 53 | math = 54 | root: Math.sqrt 55 | square: square 56 | cube: (x) -> x * square x 57 | #=> var math = { 58 | # "root": Math.sqrt, 59 | # "square": square, 60 | # "cube": function(x) { return x * square(x); } 61 | #} 62 | 63 | # "Splats": 64 | race = (winner, runners...) -> 65 | print winner, runners 66 | #=>race = function() { 67 | # var runners, winner; 68 | # winner = arguments[0], runners = 2 <= arguments.length ? __slice.call(arguments, 1) : []; 69 | # return print(winner, runners); 70 | #}; 71 | 72 | # Existenz-Operator: 73 | alert "Hab ich's nicht gesagt?" if elvis? 74 | #=> if(typeof elvis !== "undefined" && elvis !== null) { alert("Hab ich's nicht gesagt?"); } 75 | 76 | # Listen-Abstraktion: 77 | cubes = (math.cube num for num in list) 78 | #=>cubes = (function() { 79 | # var _i, _len, _results; 80 | # _results = []; 81 | # for (_i = 0, _len = list.length; _i < _len; _i++) { 82 | # num = list[_i]; 83 | # _results.push(math.cube(num)); 84 | # } 85 | # return _results; 86 | # })(); 87 | 88 | foods = ['Brokkoli', 'Spinat', 'Schokolade'] 89 | eat food for food in foods when food isnt 'Schokolade' 90 | #=>foods = ['Brokkoli', 'Spinat', 'Schokolade']; 91 | # 92 | #for (_k = 0, _len2 = foods.length; _k < _len2; _k++) { 93 | # food = foods[_k]; 94 | # if (food !== 'Schokolade') { 95 | # eat(food); 96 | # } 97 | #} 98 | ``` 99 | 100 | ## Weiterführende Links 101 | 102 | - [Smooth CoffeeScript](http://autotelicum.github.io/Smooth-CoffeeScript/) 103 | - [CoffeeScript Ristretto](https://leanpub.com/coffeescript-ristretto/read) 104 | -------------------------------------------------------------------------------- /de/hq9+.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Alexey Nazaroff", "https://github.com/rogaven"] 4 | translators: 5 | - ["Dennis Keller", "https://github.com/denniskeller"] 6 | --- 7 | 8 | HQ9+ ist eine Parodie auf esoterische Programmiersprachen und wurde von Cliff Biffle kreiert. 9 | Die Sprache hat nur vier Befehle und ist nicht Turing-vollständig. 10 | 11 | ``` 12 | Es gibt nur vier Befehle, die durch die folgenden vier Zeichen dargestellt werden 13 | H: druckt "Hello, world!" 14 | Q: druckt den Quellcode des Programms (ein Quine) 15 | 9: druckt den Liedtext von "99 Bottles of Beer" 16 | +: erhöhe den Akkumulator um Eins (Der Wert des Akkumulators kann nicht gelesen werden) 17 | Jedes andere Zeichen wird ignoriert. 18 | 19 | Ok. Lass uns ein Programm schreiben: 20 | HQ 21 | 22 | Ergebnis: 23 | Hello world! 24 | HQ 25 | 26 | HQ9+ ist zwar sehr simpel, es erlaubt aber dir Sachen zu machen, die in 27 | anderen Sprachen sehr schwierig sind. Zum Beispiel druckt das folgende Programm 28 | drei Mal Kopien von sich selbst auf den Bildschirm: 29 | QQQ 30 | Dies druckt: 31 | QQQ 32 | QQQ 33 | QQQ 34 | ``` 35 | 36 | Und das ist alles. Es gibt sehr viele Interpreter für HQ9+. 37 | Unten findest du einen von ihnen. 38 | 39 | + [One of online interpreters](https://almnet.de/esolang/hq9plus.php) 40 | + [HQ9+ official website](http://cliffle.com/esoterica/hq9plus.html) 41 | -------------------------------------------------------------------------------- /de/json.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Anna Harren", "https://github.com/iirelu"] 4 | - ["Marco Scannadinari", "https://github.com/marcoms"] 5 | translators: 6 | - ["Timm Albers", "https://github.com/nunull"] 7 | --- 8 | 9 | Da JSON ein äußerst einfaches Format für den Austausch von Daten ist, wird dieses 10 | Dokument das vermutlich einfachste "Learn X in Y Minutes" werden. 11 | 12 | In seiner grundlegenden Form hat JSON keine eigentlichen Kommentare. Dennoch 13 | akzeptieren die meisten Parser Kommentare in C-Syntax (`//`, `/* */`). Dennoch 14 | soll für dieses Dokument nur 100 % gültiges JSON verwendet werden, weshalb keine 15 | Kommentare verwendet werden. Glücklicherweise ist das nachfolgende Dokument 16 | selbsterklärend. 17 | 18 | ```json 19 | { 20 | "schlüssel": "wert", 21 | 22 | "alle schlüssel": "müssen durch doppelte Anführungszeichen begrenzt werden", 23 | "zahlen": 0, 24 | "zeichenketten": "Alle Unicode-Zeichen (inklusive \"escaping\") sind erlaubt.", 25 | "boolesche werte": true, 26 | "nullwert": null, 27 | 28 | "große zahlen": 1.2e+100, 29 | 30 | "objekte": { 31 | "kommentar": "Die meisten Datenstrukturen in JSON kommen aus Objekten.", 32 | 33 | "array": [0, 1, 2, "Arrays können Werte jeglichen Datentyps aufnehmen.", 4], 34 | 35 | "weiteres objekt": { 36 | "kommentar": "Objekte können verschachtelt werden." 37 | } 38 | }, 39 | 40 | "quatsch": [ 41 | { 42 | "quellen von kalium": ["Bananen"] 43 | }, 44 | [ 45 | [1, 0, 0, 0], 46 | [0, 1, 0, 0], 47 | [0, 0, 1, "Neo"], 48 | [0, 0, 0, 1] 49 | ] 50 | ], 51 | 52 | "alternative formatierung": { 53 | "kommentar": "..." 54 | , "die position": "des Kommas ist nicht relevant - so lange es vor dem Wert steht." 55 | , "weiterer kommentar": "wie schön" 56 | , "übrigens": "Auch die Einrückung ist nicht relevant." 57 | , "jede": "beliebige Anzahl von Leerzeichen / Tabs ist erlaubt.", "wirklich?":true 58 | }, 59 | 60 | "das war kurz": "Und, du bist fertig. Du weißt nun (fast) alles über JSON." 61 | } 62 | ``` 63 | -------------------------------------------------------------------------------- /de/pyqt.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Nathan Hughes", "https://github.com/sirsharpest"] 4 | translators: 5 | - ["Dennis Keller", "https://github.com/denniskeller"] 6 | --- 7 | 8 | **Qt** ist ein weit bekanntes Framework, mit dem man plattformunabhängige Programme schreiben kann, 9 | die auf verschiedenen Software- und Hardwareplattformen laufen, mit kleinen oder keinen Änderungen im Code. 10 | Dabei besitzen sie trotzdem die Power und Geschwindigkeit von nativen Anwendungen. 11 | **Qt** wurde ursprünglich in *C++** geschrieben. 12 | 13 | Das ist eine Adaption von dem C++ Intro für QT von [Aleksey Kholovchuk](https://github.com/vortexxx192), 14 | manche der Codebeispiele sollten in derselben Funktionalität resultieren. 15 | Diese Version wurde in pyqt erstellt. 16 | 17 | ```python 18 | import sys 19 | from PyQt4 import QtGui 20 | 21 | def window(): 22 | # Erschafft ein Anwendungsobjekt. 23 | app = QtGui.QApplication(sys.argv) 24 | # Erschafft ein Widget, auf dem unser Label platziert wird. 25 | w = QtGui.QWidget() 26 | # Fügt ein Label zu dem Widget hinzu. 27 | b = QtGui.QLabel(w) 28 | # Setzt einen Text für das Label. 29 | b.setText("Hello World!") 30 | # Setzt die Größe und die Platzierungsinformationen. 31 | w.setGeometry(100, 100, 200, 50) 32 | b.move(50, 20) 33 | # Setzt unserem Fenster einen schönen Titel. 34 | w.setWindowTitle("PyQt") 35 | # Lässt alles anzeigen. 36 | w.show() 37 | # Führe alles aus, nachdem wir alles aufgebaut haben. 38 | sys.exit(app.exec_()) 39 | 40 | if __name__ == '__main__': 41 | window() 42 | ``` 43 | 44 | Damit wir weitere fortgeschrittene Funktionen in **pyqt** verwenden können, 45 | müssen wir anfangen zusätzliche Elemente zu bauen. 46 | Hier zeigen wir wie man eine Dialog Popup Box einführt. 47 | Diese ist nützlich, um dem Benutzer eine Entscheidung zu bestätigen oder Informationen anzuzeigen. 48 | 49 | ```python 50 | import sys 51 | from PyQt4.QtGui import * 52 | from PyQt4.QtCore import * 53 | 54 | 55 | def window(): 56 | app = QApplication(sys.argv) 57 | w = QWidget() 58 | # Erschafft einen Knopf und fügt das Widget w hinzu 59 | b = QPushButton(w) 60 | b.setText("drücke mich") 61 | b.move(50, 50) 62 | # Wenn b gedrückt wird, wird diese Funktion aufgerufen. 63 | # Bemerke das Fehlen von () bei dem Funktionsaufruf. 64 | b.clicked.connect(showdialog) 65 | w.setWindowTitle("PyQt Dialog") 66 | w.show() 67 | sys.exit(app.exec_()) 68 | 69 | # Diese Funktion soll ein Dialogfenster mit einem Knopf erschaffen. 70 | # Der Knopf wartet, bis er geklickt wird, und beendet das Programm. 71 | def showdialog(): 72 | d = QDialog() 73 | b1 = QPushButton("ok", d) 74 | b1.move(50, 50) 75 | d.setWindowTitle("Dialog") 76 | # Diese Modalität sagt dem Popup, dass es den Parent blocken soll, solange es aktiv ist. 77 | d.setWindowModality(Qt.ApplicationModal) 78 | # Beim Klicken möchte ich, dass der gesamte Prozess beendet wird. 79 | b1.clicked.connect(sys.exit) 80 | d.exec_() 81 | 82 | if __name__ == '__main__': 83 | window() 84 | ``` 85 | -------------------------------------------------------------------------------- /el/json.md: -------------------------------------------------------------------------------- 1 | --- 2 | filename: json.json 3 | contributors: 4 | - ["Anna Harren", "https://github.com/iirelu"] 5 | - ["Marco Scannadinari", "https://github.com/marcoms"] 6 | - ["himanshu", "https://github.com/himanshu81494"] 7 | - ["Michael Neth", "https://github.com/infernocloud"] 8 | - ["Athanasios Emmanouilidis", "https://github.com/athanasiosem"] 9 | translators: 10 | - ["Athanasios Emmanouilidis", "https://github.com/athanasiosem"] 11 | --- 12 | 13 | Το JSON (JavaScript Object Notation) είναι ένα πολύ απλό και ελαφρύ μορφότυπο ανταλλαγής δεδομένων. Όπως αναφέρεται και στην ιστοσελίδα [json.org](http://json.org), το JSON διαβάζεται και γράφεται εύκολα από τους ανθρώπους όπως επίσης αναλύεται και παράγεται εύκολα από τις μηχανές. 14 | 15 | Ένα κομμάτι JSON δηλώνει ένα από τα παρακάτω: 16 | 17 | * Μια συλλογή από ζευγάρια ονομάτων/τιμών (collection of name/value pairs) (`{ }`). Σε πολλές γλώσσες προγραμματισμού αυτό αντιστοιχεί σε ένα αντικείμενo (object), μία εγγραφή (record), μία δομή (struct), ένα λεξικό (dictionary), ένα πίνακα κατακερματισμού (hash table), μια λίστα αριθμημένη με κλειδιά (keyed list) ή έναν πίνακα συσχέτισης (associative array). 18 | 19 | * Μια ταξινομημένη λίστα τιμών (`[ ]`). Σε πολλές γλώσσες προγραμματισμού αυτό αντιστοιχεί σε ένα πίνακα (array), σε ένα διάνυσμα (vector), μία λίστα (list), ή μια ακολουθία (sequence). 20 | 21 | Αν και το JSON στην καθαρότερη του μορφή δεν έχει σχόλια (comments), οι περισσότεροι parsers θα δεχτούν σχόλια (comments) του στύλ της γλώσσας C (`//`, `/* */`). Κάποιοι parsers επίσης ανέχονται ένα εξτρά κόμμα στο τέλος (δηλαδή ένα κόμα μετά το τελευταίο στοιχείο ενός πίνακα ή μετά την τελευταία ιδιότητα ενός αντικειμένου) αλλά καλύτερα θα είναι να αποφεύγεται η χρήση του για χάρη της συμβατότητας. 22 | 23 | Υποστηριζόμενοι τύποι δεδομένων (data types): 24 | 25 | * Συμβολοσειρές (Strings): `"Γεια"`, `"\"Περικοπή.\""`, `"\u0abe"`, `"Νέα γραμμή.\n"` 26 | * Αριθμοί (Numbers): `23`, `0.11`, `12e10`, `3.141e-10`, `1.23e+4` 27 | * Αντικείμενα (Objects): `{ "κλειδί": "τιμή" }` 28 | * Πίνακες (Arrays): `["Τιμή1","Τιμή2","Τιμή3",]` 29 | * Διάφορα : `true`, `false`, `null` 30 | 31 | ```json 32 | { 33 | "κλειδί": "τιμή", 34 | "κλειδιά": "πρέπει πάντα να περιβάλονται από διπλά quotes", 35 | "νούμερα": 0, 36 | "συμβολοσειρές": "Γεια, κόσμε. Οι χαρακτήρες unicode επιτρέπονται, καθώς και το \"escaping\".", 37 | "διαδικές τιμές": true, 38 | "κενό": null, 39 | "μεγάλοι αριθμοί": 1.2e+100, 40 | "αντικείμενα": { 41 | "σχόλια": "Σήμερα έφαγα ένα μήλο.", 42 | "πίνακες": [0, 1, 2, 3, "Οι πίνακες μπορούνε να περιλαμβάνουν διαφορετικούς τύπους δεδομένων", 5], 43 | "αντικείμενα μέσα σε αντικείμενα": { 44 | "σχόλια": "Τα αντικείμενα μπορούνε να εσωκλύουν αντικείμενα." 45 | } 46 | }, 47 | 48 | 49 | "κενό διάστημα": "Αναγνωρίζεται χωρίς πρόβλημα αλλά καλύτερα να αποφεύγεται η χρήση του.", 50 | "αυτό ήταν": "Πλέον γνωρίζετε πως μπορείτε να χρησιμοποιήσετε το JSON." 51 | } 52 | ``` 53 | 54 | ## Περαιτέρω διάβασμα 55 | 56 | * [JSON.org](http://json.org) 57 | 58 | * [JSON Tutorial](https://www.youtube.com/watch?v=wI1CWzNtE-M) 59 | -------------------------------------------------------------------------------- /es/coffeescript.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Tenor Biel", "http://github.com/L8D"] 4 | translators: 5 | - ["Pablo Elices", "http://github.com/pabloelices"] 6 | --- 7 | 8 | ``` coffeescript 9 | # CoffeeScript es un lenguaje hipster. 10 | # Tiene convenciones de muchos lenguajes modernos. 11 | # Los comentarios son como en Ruby y Python, usan almohadillas. 12 | 13 | ### 14 | Los comentarios en bloque son como estos, y se traducen directamente a '/*' y '*/' 15 | para el código JavaScript resultante. 16 | 17 | Deberías entender la mayor parte de la semántica de JavaScript antes de continuar. 18 | ### 19 | 20 | # Asignación: 21 | number = 42 #=> var number = 42; 22 | opposite = true #=> var opposite = true; 23 | 24 | # Condiciones: 25 | number = -42 if opposite #=> if(opposite) { number = -42; } 26 | 27 | # Funciones: 28 | square = (x) -> x * x #=> var square = function(x) { return x * x; } 29 | 30 | # Rangos: 31 | list = [1..5] #=> var list = [1, 2, 3, 4, 5]; 32 | 33 | # Objetos: 34 | math = 35 | root: Math.sqrt 36 | square: square 37 | cube: (x) -> x * square x 38 | #=> var math = { 39 | # "root": Math.sqrt, 40 | # "square": square, 41 | # "cube": function(x) { return x * square(x); } 42 | #} 43 | 44 | # Número de argumentos variable: 45 | race = (winner, runners...) -> 46 | print winner, runners 47 | 48 | # Existencia: 49 | alert "I knew it!" if elvis? 50 | #=> if(typeof elvis !== "undefined" && elvis !== null) { alert("I knew it!"); } 51 | 52 | # Listas: 53 | cubes = (math.cube num for num in list) #=> ... 54 | ``` 55 | -------------------------------------------------------------------------------- /es/hq9+.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Alexey Nazaroff", "https://github.com/rogaven"] 4 | translators: 5 | - ["Roberto R", "https://github.com/rrodriguze"] 6 | --- 7 | 8 | HQ9+ es una parodia de los lenguajes de programación esotéricos y fue creado 9 | por Cliff Biffle. 10 | El lenguaje tiene solo cuatro comandos y no está completo de Turing. 11 | 12 | ``` 13 | Solo hay cuatro comandos, representados por los siguientes cuatro caracteres 14 | H: imprime "Hello, world!" 15 | Q: imprime el código fuente del programa (ein Quine) 16 | 9: imprime la letra de "99 Bottles of Beer" 17 | +: aumenta el acumulador en uno (el valod del acumulador no se puede leer) 18 | Cualquier otro caracter es ignorado. 19 | 20 | Ok. Escribamos el programa: 21 | HQ 22 | 23 | Resultado: 24 | Hello world! 25 | HQ 26 | 27 | HQ9+ es muy simple, pero te permite hacer cosas en él. Otros lenguajes son muy 28 | difíciles.Por ejemplo, el siguiente programa imprime tres copias de sí mismo en 29 | la pantalla: 30 | QQQ 31 | Esto imprime: 32 | QQQ 33 | QQQ 34 | QQQ 35 | ``` 36 | 37 | Y esto es todo. Hay muchos intérpretes para HQ9+. 38 | A continuación encontrarás uno de ellos. 39 | 40 | + [One of online interpreters](https://almnet.de/esolang/hq9plus.php) 41 | + [HQ9+ official website](http://cliffle.com/esoterica/hq9plus.html) 42 | -------------------------------------------------------------------------------- /es/json.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Anna Harren", "https://github.com/iirelu"] 4 | - ["Marco Scannadinari", "https://github.com/marcoms"] 5 | translators: 6 | - ["Daniel Zendejas","https://github.com/DanielZendejas"] 7 | --- 8 | 9 | Siendo JSON un formato de intercambio de infomación tan sencillo, probablemente este será el Learn X in Y más sencillo jamás. 10 | 11 | JSON en su forma más pura no tiene comentarios, pero la mayoría de los parseadores aceptarán comentarios de C (//, /\* \*/). De todas formas, para el propóstio de esto todo será JSON 100% válido. Por suerte, habla por sí mismo. 12 | 13 | ```json 14 | { 15 | "llave": "valor", 16 | 17 | "llaves": "siempre debe estar entre comillas (ya sean dobles o simples)", 18 | "numeros": 0, 19 | "strings": "Høla, múndo. Todo el unicode está permitido, así como \"escapar\".", 20 | "¿soporta booleanos?": true, 21 | "vacíos": null, 22 | 23 | "numero grande": 1.2e+100, 24 | 25 | "objetos": { 26 | "comentario": "La mayoría de tu estructura vendrá de objetos.", 27 | 28 | "arreglo": [0, 1, 2, 3, "Los arreglos pueden contener cualquier cosa.", 5], 29 | 30 | "otro objeto": { 31 | "comentario": "Estas cosas pueden estar anidadas, muy útil." 32 | } 33 | }, 34 | 35 | "tontería": [ 36 | { 37 | "fuentes de potasio": ["bananas"] 38 | }, 39 | [ 40 | [1, 0, 0, 0], 41 | [0, 1, 0, 0], 42 | [0, 0, 1, "neo"], 43 | [0, 0, 0, 1] 44 | ] 45 | ], 46 | 47 | "estilo alternativo": { 48 | "comentario": "Mira esto!" 49 | , "posición de la coma": "no importa - mientras este antes del valor, entonces sera válido" 50 | , "otro comentario": "qué lindo" 51 | }, 52 | 53 | "eso fue rapido": "Y, estás listo. Ahora sabes todo lo que JSON tiene para ofrecer." 54 | } 55 | ``` 56 | -------------------------------------------------------------------------------- /es/pcre.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Sachin Divekar", "http://github.com/ssd532"] 4 | translators: 5 | - ["Roberto R", "https://github.com/rrodriguze"] 6 | --- 7 | 8 | Una expresión regular (regex o regexp para abreviar) es una cadena especial 9 | utilizada para definir un patrón, por ejemplo, buscar una secuencia de 10 | caracteres; por ejemplo, `/^[a-z]+:/` se puede usar para extraer `http:` 11 | desde la URL `http://github.com/`. 12 | 13 | PCRE (Pearl Compatible Regular Expressions) es una biblioteca para expresiones 14 | muy similar a la Perls, desde ahí el nombre. Se trata de una de las sintaxis 15 | más comunes para escribir expresiones regulares. 16 | 17 | Hay dos tipos de metacaracteres (caracteres con una función especial): 18 | 19 | * Caracteres reconocidos en todas partes excepto corchetes 20 | 21 | ``` 22 | \ caracter de escape 23 | ^ buscar al principio de la cadena (o línea, en modo multilínea) 24 | $ busca al final de la cadena (o línea, en modo multilínea) 25 | . cualquier caracter exceptoo las nuevas líneas 26 | [ inicio de clase de caracter 27 | | condiciones alternativas del separador 28 | ( inicio del subpatrón 29 | ) fin del subpatrón 30 | ? cuantificador "0 o 1" 31 | * quantificatore "0 o más" 32 | + quantificatore "1 o más" 33 | { inicio de cuantificador numérico 34 | ``` 35 | 36 | * Caracteres reconocidos entre corchetes 37 | 38 | ``` 39 | \ caracter de escape 40 | ^ negar la clase si es el primer caracter 41 | - indica una serie de caracteres 42 | [ clase de caracteres POSIX (si sigue la sintaxis POSIX) 43 | ] termina la clase de caracteres 44 | ``` 45 | 46 | PCRE también proporciona clases de caracteres predefinidas 47 | 48 | ``` 49 | \d cifra decimal 50 | \D cifra NO decimal 51 | \h espacio horizontal vacío 52 | \H espacio horizontal NO vacío 53 | \s espacio 54 | \S NO esoacui 55 | \v espacio vertical vacío 56 | \V espacio vertical NO vacío 57 | \w palabra 58 | \W "NO palabra" 59 | ``` 60 | 61 | ## Ejemplos 62 | 63 | Usaremos la siguiente cadena para nuestras pruebas: 64 | 65 | ``` 66 | 66.249.64.13 - - [18/Sep/2004:11:07:48 +1000] "GET /robots.txt HTTP/1.0" 200 468 "-" "Googlebot/2.1" 67 | ``` 68 | 69 | Se trata de una línea de log del servidor web Apache. 70 | 71 | | Regex | Resultado | Comentario | 72 | | :---- | :-------------- | :------ | 73 | | `GET` | GET | Busque exactamente la cadena "GET" (distingue entre mayúsculas y minúsculas) | 74 | | `\d+.\d+.\d+.\d+` | 66.249.64.13 | `\d+` identifica uno o más (cuantificador `+`) números [0-9], `\.` identifica el caracter `.` | 75 | | `(\d+\.){3}\d+` | 66.249.64.13 | `(\d+\.){3}` busca el grupo (`\d+\.`) exactamente 3 veces. | 76 | | `\[.+\]` | [18/Sep/2004:11:07:48 +1000] | `.+` identifica cualquier caracter, excepto las nuevas líneas; `.` indica cualquier carácter | 77 | | `^\S+` | 66.249.64.13 | `^` buscar al inicio de la cadena, `\S+` identifica la primera cadena de caracteres que no sea espacio | 78 | | `\+[0-9]+` | +1000 | `\+` identifica el caracter `+`. `[0-9]` indica una cifra de 0 a 9. La expresión es equivalente a `\+\d+` | 79 | 80 | ## Otros recursos 81 | [Regex101](https://regex101.com/) - probador de expresiones regulares 82 | -------------------------------------------------------------------------------- /es/pyqt.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Nathan Hughes", "https://github.com/sirsharpest"] 4 | translators: 5 | - ["Adrian Rocamora", "https://github.com/adrianrocamora"] 6 | --- 7 | 8 | **Qt** es un sistema altamente reconocido que permite desarrollar software multiplataforma que puede correr en diferentes entornos de software y hardware con pocos o ningún cambio. Aun así conserva la velocidad y poder de una aplicación nativa. **Qt** fue originalmente escrito en *C++*. 9 | 10 | Esta es una adaptación de la introducción a QT con C++ por [Aleksey Kholovchuk](https://github.com/vortexxx192), parte del código ejemplo debería resultar en la misma funcionalidad ¡pero usando python con PyQT! 11 | 12 | ```python 13 | import sys 14 | from PyQt4 import QtGui 15 | 16 | def window(): 17 | # Crear el objeto de la aplicación 18 | app = QtGui.QApplication(sys.argv) 19 | # Crear un widget en el que colocaremos nuestra etiqueta 20 | w = QtGui.QWidget() 21 | # Agregamos nuestra etiqueta al widget 22 | b = QtGui.QLabel(w) 23 | # Agregamos texto a nuestra etiqueta 24 | b.setText("Hello World!") 25 | # Fijemos información de posición y tamaño del widget 26 | w.setGeometry(100, 100, 200, 50) 27 | b.move(50, 20) 28 | # Proporcionemos un título a nuestra ventana 29 | w.setWindowTitle("PyQt") 30 | # Mostremos todo 31 | w.show() 32 | # Ejecutemos lo que hayamos solicitado ya inicializado el resto 33 | sys.exit(app.exec_()) 34 | 35 | if __name__ == '__main__': 36 | window() 37 | ``` 38 | 39 | Para poder hacer uso de las funciones más avanzades en **pyqt** necesitamos agregar elementos adicionales. 40 | Aquí mostramos cómo introducir una caja de diálogo popup, útil para permitir al usuario confirmar su decisión o para brindarnos información. 41 | 42 | ```python 43 | import sys 44 | from PyQt4.QtGui import * 45 | from PyQt4.QtCore import * 46 | 47 | 48 | def window(): 49 | app = QApplication(sys.argv) 50 | w = QWidget() 51 | # Crear un botón y adjuntarlo al widget w 52 | b = QPushButton(w) 53 | b.setText("Press me") 54 | b.move(50, 50) 55 | # Indicar al botón b que llame esta función cuando reciba un click 56 | # Nótese la falta de "()" en la llamada de la función 57 | b.clicked.connect(showdialog) 58 | w.setWindowTitle("PyQt Dialog") 59 | w.show() 60 | sys.exit(app.exec_()) 61 | 62 | # Esta función debería crear una ventana de diálogo con un botón 63 | # que espera a recibir un click y luego sale del programa 64 | def showdialog(): 65 | d = QDialog() 66 | b1 = QPushButton("ok", d) 67 | b1.move(50, 50) 68 | d.setWindowTitle("Dialog") 69 | # Esta modalidad le indica al popup que bloquee al padre mientras activo 70 | d.setWindowModality(Qt.ApplicationModal) 71 | # Al recibir un click me gustaría que el proceso termine 72 | b1.clicked.connect(sys.exit) 73 | d.exec_() 74 | 75 | if __name__ == '__main__': 76 | window() 77 | ``` 78 | -------------------------------------------------------------------------------- /fr/coffeescript.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Tenor Biel", "http://github.com/L8D"] 4 | translators: 5 | - ["Geoffrey Roguelon", "https://github.com/GRoguelon"] 6 | --- 7 | 8 | ``` coffeescript 9 | # CoffeeScript est un langage préprocesseur, il permet de générer du JavaScript. 10 | # Il suit les tendances de certains langages récents. 11 | # Par exemple, les commentaires se définissent comme en Ruby ou en Python. 12 | 13 | ### 14 | Ceci est un bloc de commentaires 15 | il est converti directement avec '/ *' et '* /' 16 | pour correspondre aux commentaires JavaScript 17 | 18 | Vous devez comprendre la syntaxe du langage JavaScript pour continuer. 19 | ### 20 | 21 | # Affectation : 22 | number = 42 #=> var number = 42; 23 | opposite = true #=> var opposite = true; 24 | 25 | # Structures de contrôle : 26 | number = -42 if opposite #=> if(opposite) { number = -42; } 27 | 28 | # Fonctions : 29 | square = (x) -> x * x #=> var square = function(x) { return x * x; } 30 | 31 | # Intervals : 32 | list = [1..5] #=> var list = [1, 2, 3, 4, 5]; 33 | 34 | # Objets : 35 | math = 36 | root: Math.sqrt 37 | square: square 38 | cube: (x) -> x * square x 39 | #=> var math = { 40 | # "root": Math.sqrt, 41 | # "square": square, 42 | # "cube": function(x) { return x * square(x); } 43 | #} 44 | 45 | # Liste d'arguments variables : 46 | race = (winner, runners...) -> 47 | print winner, runners 48 | 49 | # Existance : 50 | alert "I knew it!" if elvis? 51 | #=> if(typeof elvis !== "undefined" && elvis !== null) { alert("I knew it!"); } 52 | 53 | # Lecture d'un tableau : 54 | cubes = (math.cube num for num in list) #=> ... 55 | ``` 56 | -------------------------------------------------------------------------------- /fr/json.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Anna Harren", "https://github.com/iirelu"] 4 | - ["Marco Scannadinari", "https://github.com/marcoms"] 5 | translators: 6 | - ["Alois de Gouvello","https://github.com/aloisdg"] 7 | --- 8 | 9 | Comme JSON est un format d'échange de données extrêmement simple, ce Apprendre X en Y minutes 10 | est susceptible d'être le plus simple jamais réalisé. 11 | 12 | JSON dans son état le plus pur n'a aucun commentaire, mais la majorité des parseurs accepterons 13 | les commentaires du langage C (`//`, `/* */`). Pour les besoins de ce document, cependant, 14 | tout sera du JSON 100% valide. Heureusement, il s'explique par lui-même. 15 | 16 | 17 | ```json 18 | { 19 | "Clé": "valeur", 20 | 21 | "Clés": "devront toujours être entourées par des guillemets", 22 | "nombres": 0, 23 | "chaînes de caractères": "Hellø, wørld. Tous les caractères Unicode sont autorisés, accompagné d'un \"caractère d'échappement\".", 24 | "a des booléens ?": true, 25 | "rien": null, 26 | 27 | "grand nombre": 1.2e+100, 28 | 29 | "objets": { 30 | "commentaire": "La majorité de votre strucutre sera des objets.", 31 | 32 | "tableau": [0, 1, 2, 3, "Les tableaux peuvent contenir n'importe quoi.", 5], 33 | 34 | "un autre objet": { 35 | "commentaire": "Ces choses peuvent être imbriquées. C'est très utile." 36 | } 37 | }, 38 | 39 | "bêtises": [ 40 | { 41 | "sources de potassium": ["bananes"] 42 | }, 43 | [ 44 | [1, 0, 0, 0], 45 | [0, 1, 0, 0], 46 | [0, 0, 1, "neo"], 47 | [0, 0, 0, 1] 48 | ] 49 | ], 50 | 51 | "style alternatif": { 52 | "commentaire": "regarde ça !" 53 | , "position de la virgule": "n'a pas d'importance - aussi longtemps qu'elle est avant la valeur, alors elle est valide." 54 | , "un autre commentaire": "comme c'est gentil" 55 | }, 56 | 57 | "C'était court": "Et, vous avez terminé. Maintenant, vous savez tout ce que JSON a à offrir." 58 | } 59 | ``` 60 | -------------------------------------------------------------------------------- /fr/pyqt.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Nathan Hughes", "https://github.com/sirsharpest"] 4 | translators: 5 | - ["DevHugo", "http://twitter.com/devhugo"] 6 | --- 7 | 8 | **Qt** est un framework très connu pour le développement de logiciel cross-platform qui peuvent être lancé sur différents systèmes avec de petit ou aucun changement dans le code, tout en ayant la puissance et la vitesse des applications natives. Bien que **Qt** ait été écrit à l'origine en *C++*. 9 | 10 | 11 | Ceci est une adaptation de l'intro C++ à QT par [Aleksey Kholovchuk](https://github.com/vortexxx192 12 | ), certains exemples du code doivent avoir la même fonctionnalité, 13 | cette version ayant juste été faite en utilisant pyqt! 14 | 15 | ```python 16 | import sys 17 | from PyQt4 import QtGui 18 | 19 | def window(): 20 | # Création de l'objet application 21 | app = QtGui.QApplication(sys.argv) 22 | # Création d'un widget où notre label sera placé 23 | w = QtGui.QWidget() 24 | # Ajout d'un label au widget 25 | b = QtGui.QLabel(w) 26 | # Assignation de texte au label 27 | b.setText("Hello World!") 28 | # Assignation des tailles et des informations de placement 29 | w.setGeometry(100, 100, 200, 50) 30 | b.move(50, 20) 31 | # Assignation d'un nom à notre fenêtre 32 | w.setWindowTitle("PyQt") 33 | # Affichage de la fenêtre 34 | w.show() 35 | # Exécution de l'application 36 | sys.exit(app.exec_()) 37 | 38 | if __name__ == '__main__': 39 | window() 40 | ``` 41 | 42 | Pour obtenir certaines des fonctionnalités les plus avancées de **pyqt** nous devons commencer par chercher à construire des éléments supplémentaires. 43 | Ici nous voyons comment introduire une boîte de dialogue popup, utile pour demander une confirmation à un utilisateur ou fournir des informations. 44 | 45 | ```python 46 | import sys 47 | from PyQt4.QtGui import * 48 | from PyQt4.QtCore import * 49 | 50 | 51 | def window(): 52 | app = QApplication(sys.argv) 53 | w = QWidget() 54 | # Creation d'un bouton attaché au widget w 55 | b = QPushButton(w) 56 | b.setText("Press me") 57 | b.move(50, 50) 58 | # Dire à b d'appeler cette fonction quand il est cliqué 59 | # remarquez l'absence de "()" sur l'appel de la fonction 60 | b.clicked.connect(showdialog) 61 | w.setWindowTitle("PyQt Dialog") 62 | w.show() 63 | sys.exit(app.exec_()) 64 | 65 | # Cette fonction devrait créer une fenêtre de dialogue avec un bouton 66 | # qui attend d'être cliqué puis quitte le programme 67 | def showdialog(): 68 | d = QDialog() 69 | b1 = QPushButton("ok", d) 70 | b1.move(50, 50) 71 | d.setWindowTitle("Dialog") 72 | # Cette modalité dit au popup de bloquer le parent pendant qu'il est actif 73 | d.setWindowModality(Qt.ApplicationModal) 74 | # En cliquant je voudrais que tout le processus se termine 75 | b1.clicked.connect(sys.exit) 76 | d.exec_() 77 | 78 | if __name__ == '__main__': 79 | window() 80 | ``` 81 | -------------------------------------------------------------------------------- /hi/json.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Anna Harren", "https://github.com/iirelu"] 4 | - ["Marco Scannadinari", "https://github.com/marcoms"] 5 | - ["himanshu", "https://github.com/himanshu81494"] 6 | - ["Michael Neth", "https://github.com/infernocloud"] 7 | - ["Athanasios Emmanouilidis", "https://github.com/athanasiosem"] 8 | translators: 9 | - ["Namami Shanker", "https://github.com/NamamiShanker"] 10 | --- 11 | 12 | जैसन(JSON) इस अत्यंत सरल डाटा-इंटरचेंज फॉर्मेट है| जैसा [json.org](https://json.org) कहती है, ये इंसानो के पढ़ने और लिखने के लिए भी आसान है और और मशीन के लिए इसे पार्स और उतपन्न करना भी बेहद सरल है| 13 | 14 | जैसन(JSON) के एक अंश को इनमे से किसी एक का प्रतिनिधित्व(represent) करना चाहिए: 15 | 16 | * एक नाम/वैल्यू जोड़े का कलेक्शन (`{ }`). कई दूसरी भाषाओ में इसे ऑब्जेक्ट, रिकॉर्ड, स्ट्रक्ट, डिक्शनरी, हैश टेबल, कीड लिस्ट, या असोसिएटिव ऐरे का भी नाम दिया जाता है| 17 | * वैल्यूज की एक व्यवस्थित लिस्ट(ordered list) (`[ ]`). कई दूसरी भाषाओ में इसे ऐरे, वेक्टर, लिस्ट, या सीक्वेंस भी कहा जाता है| 18 | 19 | जैसन(JSON) अपने शुद्धतम रूप में कमैंट्स सपोर्ट नहीं करता है, पर ज़्यादातर पारसर C स्टाइल की कमैंट्स (`//`, `/* */`) सपोर्ट करेंगे| कुछ पारसर्स अंतिम कॉमा भी स्वीकार करते हैं (जब आप किसी ऐरे के अंतिम एलिमेंट या किसी ऑब्जेक्ट की अंतिम प्रॉपर्टी के बार एक कॉमा छोड़ देते हैं), पर ऐसी गलतियों से बचना चाहिए बेहतर कम्पेटिबिलिटी के लिए| 20 | 21 | ये उदाहरण १०० प्रतिशत मान्य जैसन(JSON) है| किस्मत से, जैसन(JSON) डॉक्यूमेंट को पढ़ के ही आप इसे समझ जायेंगे| 22 | 23 | समर्थित डाटा टाइप्स: 24 | 25 | * स्ट्रिंग्स(Strings): `"नमस्ते"`, `"\"एक उद्धरण\""`, `"\u0abe"`, `"नयी पंक्ति|\n"` 26 | * अंक(Numbers): `23`, `0.11`, `12e10`, `3.141e-10`, `1.23e+4` 27 | * ऑब्जेक्ट्स(Objects): `{ "की": "मूल्य" }` 28 | * ऐरे(Arrays): `["बहुत सारे मूल्य"]` 29 | * विविध(Miscellaneous): `true`, `false`, `null` 30 | 31 | ```json 32 | { 33 | "की": "मूल्य", 34 | 35 | "की": "हमेशा दोहरे उद्धरण चिह्नों में संलग्न होना चाहिए", 36 | "अंक": 0, 37 | "स्ट्रिंग्स": "नमस्ते| यूनिकोड और \"एस्केप\" सीक्वेंस की अनुमति है|", 38 | "बूलियन है?": true, 39 | "शून्यता ": null, 40 | 41 | "बड़े अंक": 1.2e+100, 42 | 43 | "ऑब्जेक्ट्स": { 44 | "टिप्पणी": "आपके जैसन(JSON) ऑब्जेक्ट को ज़्यादातर ऑब्जेक्ट से ही ढांचा मिलेगा|", 45 | 46 | "ऐरे": [0, 1, 2, 3, "ऐरे में आप कुछ भी रख सकते हैं|", 5], 47 | 48 | "एक और ऑब्जेक्ट": { 49 | "टिप्पणी": "आप एक ऑब्जेक्ट दूसरे ऑब्जेक्ट के अंदर रख सकते हैं| ये बहुत उपयोगी होता है|" 50 | } 51 | }, 52 | 53 | "फ़र्ज़ी": [ 54 | { 55 | "पोटेशियम के स्रोत": ["केला"] 56 | }, 57 | [ 58 | [1, 0, 0, 0], 59 | [0, 1, 0, 0], 60 | [0, 0, 1, "नव"], 61 | [0, 0, 0, 1] 62 | ] 63 | ], 64 | 65 | "वैकल्पिक शैली": { 66 | "टिप्पणी": "ये देखिये!" 67 | , "कॉमा के स्थान": "से फरक नहीं पड़ता, अगर आपने उसे अगली की से पहले लगाया है तो वो मान्य है|" 68 | , "एक और टिप्पणी": "कितनी अच्छी बात है" 69 | }, 70 | 71 | 72 | 73 | "खाली स्थान": "से फरक नहीं पड़ता", 74 | 75 | 76 | 77 | "ये काफी छोटा था :>": "और ख़तम| अब आपको जैसन(JSON) के बारे में सब कुछ पता है|" 78 | } 79 | ``` 80 | 81 | ## और जानकारी के लिए 82 | 83 | * [JSON.org](https://json.org) पूरा जैसन(JSON) फ्लोचार्ट के माध्यम से खूबसूरत तरह से दर्शित| 84 | * [JSON Tutorial](https://www.youtube.com/watch?v=wI1CWzNtE-M) जैसन(JSON) का एक संक्षिप्त परिचय| 85 | -------------------------------------------------------------------------------- /hjson.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Hjson 3 | filename: learnhjson.hjson 4 | contributors: 5 | - ["MrTeferi", "https://github.com/MrTeferi"] 6 | --- 7 | 8 | Hjson is an attempt to make [JSON](../json/) more human readable. 9 | 10 | Hjson is a syntax extension to JSON. 11 | It's NOT a proposal to replace JSON or to incorporate it into the JSON spec itself. 12 | It's intended to be used like a user interface for humans, 13 | to read and edit before passing the JSON data to the machine. 14 | 15 | Let's take a look at examples to see the key syntax differences! 16 | 17 | ``` 18 | { 19 | # Comments are totally supported! 20 | 21 | // With forward slashes too! 22 | 23 | /* 24 | Even block style comments, neat! 25 | /* 26 | 27 | # Strings do not require quotes! 28 | # Just keep it to a single line 29 | human: readable 30 | quotes: "are fine too" 31 | 32 | # Notice that commas are also not required! 33 | # If using commas, strings DO require quotes! 34 | object: { 35 | name: Hjson 36 | properties: [ 37 | readable 38 | exciting 39 | fun 40 | ] 41 | with_commas: [ 42 | "quoted", 43 | "quoty", 44 | "quote" 45 | ] 46 | details: ["this", "is", "fine", "too"] 47 | } 48 | 49 | # Multiline quotes with proper whitespace handling are supported! 50 | diary: 51 | ''' 52 | I wish JSON was more human readable. 53 | If only there was a JSON for my needs! 54 | Oh wait.. there is! It's called Hjson. 55 | ''' 56 | 57 | # Backslashes are interpreted as an escape character ONLY in quoted strings 58 | slash: This will not have a new line\n 59 | slash-quoted: "This will definitely have a new line\n" 60 | 61 | # Make sure to use quotes when mixing whitespace with important punctuation 62 | example1: "If, you're, going, to, comma in a string, use, quotes!" 63 | example2: "Also if you want to use {} or [] or any JSON relevant punctuation!" 64 | example3: [because, this, is, totally, BROKEN!] 65 | example4: this is technically OK though: {}[],: 66 | 67 | # Enjoy working with Hjson! 68 | party-time: { 69 | Hjson-lovers: [ 70 | me 71 | my mom 72 | "my dad" 73 | ] 74 | Hjson-power-level: 9000 75 | supported: { 76 | python: yes 77 | java: yes 78 | javascript: yes 79 | c++: yes 80 | Go: yes 81 | C#: yes 82 | Rust: yes 83 | } 84 | partial-support: ["C", "Kotlin", "Ruby", "Rust"] 85 | } 86 | 87 | } 88 | ``` 89 | 90 | ## Further Reading 91 | 92 | * [Hjson.github.io](https://hjson.github.io/) Main Hjson site including editor support, how-to, etc. 93 | * [Hjson Packages](https://github.com/hjson/) Various Hjson packages for different applications. 94 | -------------------------------------------------------------------------------- /hq9+.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: HQ9+ 3 | filename: hq9+.txt 4 | contributors: 5 | - ["Alexey Nazaroff", "https://github.com/rogaven"] 6 | --- 7 | 8 | HQ9+ is a joke programming language created by Cliff Biffle. It has only four commands and it isn't Turing-complete. 9 | 10 | ``` 11 | There is only 4 commands, represented by next characters 12 | H: print "Hello, world!" 13 | Q: print the program's source code (a Quine) 14 | 9: print the lyrics to "99 Bottles of Beer" 15 | +: add one to the accumulator (the value of the accumulator cannot be accessed) 16 | Any other character is ignored. 17 | 18 | Ok. Let's write some program: 19 | HQ9 20 | 21 | Result: 22 | Hello world! 23 | HQ9 24 | 25 | HQ9+ is very simple, but allows you to do some things that are very difficult 26 | in other languages. For example, here is a program that creates three copies of 27 | itself on the screen: 28 | QQQ 29 | 30 | This produces: 31 | QQQ 32 | QQQ 33 | QQQ 34 | ``` 35 | 36 | And that's all. There are a lot of interpreters for HQ9+. Below you can find one of them 37 | 38 | + [One of online interpreters](https://almnet.de/esolang/hq9plus.php) 39 | + [HQ9+ official website](http://cliffle.com/esoterica/hq9plus.html) 40 | -------------------------------------------------------------------------------- /httpie.md: -------------------------------------------------------------------------------- 1 | --- 2 | category: tool 3 | name: HTTPie 4 | contributors: 5 | - ["Adaías Magdiel", "https://github.com/AdaiasMagdiel"] 6 | filename: learn-httpie.sh 7 | --- 8 | 9 | HTTPie is a powerful command-line HTTP client designed for easy interaction 10 | with HTTP servers. It provides a simple and intuitive interface, making it an 11 | excellent tool for developers, testers, and system administrators. 12 | 13 | ## Basic Usage 14 | 15 | HTTPie follows a simple syntax: http [flags] [METHOD] URL [items]. 16 | 17 | ```bash 18 | http GET https://api.example.com/posts 19 | ``` 20 | 21 | You can print the request without sending it by using the `--offline` flag. 22 | 23 | ```bash 24 | http --offline https://api.example.com/posts 25 | ``` 26 | 27 | ### URL shortcuts for `localhost` 28 | 29 | HTTPie supports a curl-like shorthand for localhost. For instance, `:3000` 30 | expands to `http://localhost:3000`. If the port is omitted, it assumes port 80. 31 | 32 | ```bash 33 | http :/users # http://localhost/users 34 | http :5000/rss # http://localhost:5000/rss 35 | ``` 36 | 37 | ### Optional GET and POST 38 | 39 | If you don't specify the METHOD, the HTTPie will use: 40 | 41 | - GET for requests without body 42 | - POST for requests with body 43 | 44 | ```bash 45 | http https://api.example.com/tags # GET tags 46 | http https://api.example.com/tags title="Tutorial" slug="tutorial" # POST a new tag 47 | ``` 48 | 49 | ## Querystring Parameters 50 | 51 | If you're manually adding query string parameters in the terminal, try the 52 | `param==value` syntax. It avoids shell escaping for & separators and 53 | automatically URL-escapes special characters in parameter names and values. 54 | This differs from parameters in the full URL, which HTTPie doesn't modify. 55 | 56 | ```bash 57 | http https://api.example.com/search q==httpie per_page==20 58 | ``` 59 | 60 | ## Sending Data 61 | 62 | You can send data in various formats such as JSON, form data, or files. 63 | 64 | ### JSON Data 65 | 66 | ```bash 67 | http POST https://api.example.com/posts title="Hello" body="World" 68 | ``` 69 | 70 | ### Form Data 71 | 72 | ```bash 73 | http -f POST https://api.example.com/submit name=John email=john@example.com 74 | ``` 75 | 76 | ### Files 77 | 78 | ```bash 79 | http --form POST https://api.example.com/upload file@/path/to/file.txt 80 | ``` 81 | 82 | ## Headers and Authentication 83 | 84 | HTTPie allows you to set headers and handle authentication easily. 85 | 86 | ### Headers 87 | 88 | ```bash 89 | http GET https://api.example.com/posts Authorization:"Bearer Token" User-Agent:"HTTPie" 90 | ``` 91 | 92 | ### Basic Authentication 93 | 94 | ```bash 95 | http -a username:password GET https://api.example.com/protected 96 | ``` 97 | 98 | ### Bearer Authentication 99 | 100 | ```bash 101 | https -A bearer -a token https://api.example.com/admin 102 | ``` 103 | 104 | ## Response Handling 105 | 106 | HTTPie provides various options for handling responses. 107 | 108 | ```bash 109 | http GET https://api.example.com/data Accept:application/json # Pretty Print JSON 110 | 111 | http GET https://api.example.com/image --output image.png # Save Response to File 112 | 113 | http --follow GET https://example.com # Follow Redirects 114 | ``` 115 | 116 | ## Further Reading 117 | 118 | - [Official Documentation](https://httpie.io/docs/cli) 119 | - [GitHub](https://github.com/httpie) 120 | -------------------------------------------------------------------------------- /hu/coffeescript.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Tenor Biel", "http://github.com/L8D"] 4 | - ["Xavier Yao", "http://github.com/xavieryao"] 5 | translators: 6 | - ["Tamás Diószegi", "http://github.com/ditam"] 7 | --- 8 | 9 | A CoffeeScript egy apró nyelv ami egy-az-egyben egyenértékű JavaScript kódra fordul, és így futásidőben már nem szükséges interpretálni. 10 | Mint a JavaScript egyik követője, a CoffeeScript mindent megtesz azért, hogy olvasható, jól formázott és jól futó JavaScript kódot állítson elő, ami minden JavaScript futtatókörnyezetben jól működik. 11 | 12 | Rézletekért lásd még a [CoffeeScript weboldalát](http://coffeescript.org/), ahol egy teljes CoffeScript tutorial is található. 13 | 14 | ```coffeescript 15 | # A CoffeeScript egy hipszter nyelv. 16 | # Követi több modern nyelv trendjeit. 17 | # Így a kommentek, mint Ruby-ban és Python-ban, a szám szimbólummal kezdődnek. 18 | 19 | ### 20 | A komment blokkok ilyenek, és közvetlenül '/ *' és '* /' jelekre fordítódnak 21 | az eredményül kapott JavaScript kódban. 22 | 23 | Mielőtt tovább olvasol, jobb, ha a JavaScript alapvető szemantikájával 24 | tisztában vagy. 25 | 26 | (A kód példák alatt kommentként látható a fordítás után kapott JavaScript kód.) 27 | ### 28 | 29 | # Értékadás: 30 | number = 42 #=> var number = 42; 31 | opposite = true #=> var opposite = true; 32 | 33 | # Feltételes utasítások: 34 | number = -42 if opposite #=> if(opposite) { number = -42; } 35 | 36 | # Függvények: 37 | square = (x) -> x * x #=> var square = function(x) { return x * x; } 38 | 39 | fill = (container, liquid = "coffee") -> 40 | "Filling the #{container} with #{liquid}..." 41 | #=>var fill; 42 | # 43 | #fill = function(container, liquid) { 44 | # if (liquid == null) { 45 | # liquid = "coffee"; 46 | # } 47 | # return "Filling the " + container + " with " + liquid + "..."; 48 | #}; 49 | 50 | # Szám tartományok: 51 | list = [1..5] #=> var list = [1, 2, 3, 4, 5]; 52 | 53 | # Objektumok: 54 | math = 55 | root: Math.sqrt 56 | square: square 57 | cube: (x) -> x * square x 58 | #=> var math = { 59 | # "root": Math.sqrt, 60 | # "square": square, 61 | # "cube": function(x) { return x * square(x); } 62 | # }; 63 | 64 | # "Splat" jellegű függvény-paraméterek: 65 | race = (winner, runners...) -> 66 | print winner, runners 67 | #=>race = function() { 68 | # var runners, winner; 69 | # winner = arguments[0], runners = 2 <= arguments.length ? __slice.call(arguments, 1) : []; 70 | # return print(winner, runners); 71 | # }; 72 | 73 | # Létezés-vizsgálat: 74 | alert "I knew it!" if elvis? 75 | #=> if(typeof elvis !== "undefined" && elvis !== null) { alert("I knew it!"); } 76 | 77 | # Tömb értelmezések: (array comprehensions) 78 | cubes = (math.cube num for num in list) 79 | #=>cubes = (function() { 80 | # var _i, _len, _results; 81 | # _results = []; 82 | # for (_i = 0, _len = list.length; _i < _len; _i++) { 83 | # num = list[_i]; 84 | # _results.push(math.cube(num)); 85 | # } 86 | # return _results; 87 | # })(); 88 | 89 | foods = ['broccoli', 'spinach', 'chocolate'] 90 | eat food for food in foods when food isnt 'chocolate' 91 | #=>foods = ['broccoli', 'spinach', 'chocolate']; 92 | # 93 | #for (_k = 0, _len2 = foods.length; _k < _len2; _k++) { 94 | # food = foods[_k]; 95 | # if (food !== 'chocolate') { 96 | # eat(food); 97 | # } 98 | #} 99 | ``` 100 | 101 | ## További források 102 | 103 | - [Smooth CoffeeScript](http://autotelicum.github.io/Smooth-CoffeeScript/) 104 | - [CoffeeScript Ristretto](https://leanpub.com/coffeescript-ristretto/read) 105 | -------------------------------------------------------------------------------- /id/asciidoc.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Ryan Mavilia", "http://unoriginality.rocks/"] 4 | translators: 5 | - ["Rizky Luthfianto", "http://github.com/rilut"] 6 | --- 7 | 8 | AsciiDoc adalah bahasa markup yang mirip dengan Markdown dan dapat digunakan untuk apa saja, untuk menulis buku maupun blog. Dibuat pada tahun 2002 oleh Stuart Rackham, bahasa ini sederhana tetapi memungkinkan sejumlah besar kustomisasi. 9 | 10 | Kepala Dokumen 11 | 12 | Kepala Dokumen adalah opsional dan tidak dapat berisi baris kosong. Harus diimbangi konten, setidaknya satu baris kosong. 13 | 14 | Hanya Judul 15 | 16 | ``` 17 | = Judul Dokumen 18 | 19 | Kalimat pertama dokumen. 20 | ``` 21 | 22 | Judul dan Penulis 23 | 24 | ``` 25 | = Judul Dokumen 26 | Pertama terakhir 27 | 28 | Awal dokumen ini. 29 | ``` 30 | 31 | Banyak Penulis 32 | 33 | ``` 34 | = Judul Dokumen 35 | John Doe ; Jane Doe ; Black Beard 36 | 37 | Memulai dokumen dengan banyak penulis. 38 | ``` 39 | 40 | Garis Revisi (membutuhkan garis penulis) 41 | 42 | ``` 43 | = Judul Dokumen V1 44 | Manusia Kentang 45 | v1.0, 2016/01/13 46 | 47 | Artikel tentang keripik ini akan menjadi menyenangkan. 48 | ``` 49 | 50 | Paragraf 51 | 52 | ``` 53 | Anda tidak perlu sesuatu yang istimewa untuk paragraf. 54 | 55 | Tambahkan baris kosong antara paragraf untuk memisahkan mereka. 56 | 57 | Untuk membuat baris kosong, tambahkan: + 58 | dan Anda akan mendapat satu baris kosong! 59 | ``` 60 | 61 | Memformat Teks 62 | 63 | ``` 64 | _underscore menciptakan miring_ 65 | *Tanda bintang untuk tebal* 66 | *_Gabungkan biar makin asyik_* 67 | `Penggunaan tanda petik untuk menandakan monospace` 68 | `*Monospace tebal*` 69 | ``` 70 | 71 | Judul bagian 72 | 73 | ``` 74 | = Level 0 (hanya dapat digunakan dalam header dokumen) 75 | 76 | == Level 1

77 | 78 | === Level 2

79 | 80 | ==== Level 3

81 | 82 | ===== Level 4

83 | ``` 84 | 85 | Daftar 86 | 87 | Untuk membuat daftar bullet, gunakan tanda bintang. 88 | 89 | ``` 90 | * foo 91 | * bar 92 | * baz 93 | ``` 94 | 95 | Untuk membuat daftar bernomor, gunakan titik. 96 | 97 | ``` 98 | . Item 1 99 | . item 2 100 | . Item 3 101 | ``` 102 | 103 | Anda bisa membuat daftar bersarang dengan menambahkan tanda bintang atau titik tambahan hingga lima kali. 104 | 105 | ``` 106 | * Foo 1 107 | ** Foo 2 108 | *** Foo 3 109 | **** Foo 4 110 | ***** Foo 5 111 | 112 | . foo 1 113 | .. Foo 2 114 | ... Foo 3 115 | .... Foo 4 116 | ..... Foo 5 117 | ``` 118 | -------------------------------------------------------------------------------- /id/coffeescript.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Tenor Biel", "http://github.com/L8D"] 4 | - ["Xavier Yao", "http://github.com/xavieryao"] 5 | translators: 6 | - ["Rizky Luthfianto", "http://github.com/rilut"] 7 | --- 8 | 9 | CoffeeScript adalah bahasa sederhana yang diterjemahkan saat kompilasi ke dalam JavaScript, 10 | dan bukan diterjemahkan pada saat *runtime*. 11 | CoffeeScript mencoba agar kode JavaScript yang dihasilkan tetap mudah dibaca 12 | dan kompatibel dengan semua *runtime* JavaScript. 13 | 14 | Lihat juga [website CoffeeScript](http://coffeescript.org/) yang memiliki tutorial lengkap tentang CoffeeScript. 15 | 16 | ```coffeescript 17 | # CoffeeScript adalah bahasa hipster. 18 | # Mengikuti tren bahasa modern lainnya. 19 | # Sehingga, seperti Ruby dan Python, untuk komentar digunakan tanda pagar. 20 | 21 | ### 22 | Ini adalah contoh blok komentar, yang nanti diterjemahkan langsung ke '/ *' dan '* /' 23 | pada kode JavaScript yang dihasilkan. 24 | 25 | Anda diharapkan sedikit memahami semantik JavaScript sebelum melanjutkan tutorial ini. 26 | ### 27 | 28 | # Pengisian nilai variabel: 29 | angka = 42 #=> var angka = 42; 30 | kebalikan = true #=> var kebalikan = true; 31 | 32 | # Kondisi: 33 | angka = -42 if kebalikan #=> if(kebalikan) { angka = -42; } 34 | 35 | # Fungsi: 36 | kuadrat = (x) -> x * x #=> var kuadrat = function(x) { return x * x; } 37 | 38 | isi = (wadah, cairan = "kopi") -> 39 | "Mengisi #{wadah} dengan #{cairan}..." 40 | #=>var isi; 41 | # 42 | #isi = function(wadah, cairan) { 43 | # if (cairan == null) { 44 | # cairan = "kopi"; 45 | # } 46 | # return "Mengisi " + wadah + " dengan " + cairan + "..."; 47 | #}; 48 | 49 | # Rentang: 50 | list = [1..5] # => var list = [1, 2, 3, 4, 5]; 51 | 52 | # Objek: 53 | fungsi_matematika = 54 | akar: Math.sqrt 55 | kuadrat: kuadrat 56 | kubik: (x) -> x * kuadrat x 57 | #=> var fungsi_matematika = { 58 | # "akar": Math.sqrt, 59 | # "kuadrat": kuadrat, 60 | # "kubik": function(x) { return x * kuadrat(x); } 61 | # }; 62 | 63 | # *Splat*: 64 | balapan = (pemenang, pelari...) -> 65 | print pemenang, pelari 66 | #=>balapan = function() { 67 | # var pelari, pemenang; 68 | # pemenang = arguments[0], pelari = 2 <= arguments.length ? __slice.call(arguments, 1) : []; 69 | # return print(pemenang, pelari); 70 | # }; 71 | 72 | # Cek keberadaan: 73 | alert "Elvis ada!" if elvis? 74 | #=> if(typeof elvis !== "undefined" && elvis !== null) { alert("Elvis ada!"); } 75 | 76 | # Komprehensi *array*: 77 | kubik_kubik = (fungsi_matematika.kubik angka for angka in list) 78 | #=>kubik_kubik = (function() { 79 | # var _i, _len, _hasil; 80 | # _hasil = []; 81 | # for (_i = 0, _len = list.length; _i < _len; _i++) { 82 | # angka = list[_i]; 83 | # _hasil.push(fungsi_matematika.kubik(angka)); 84 | # } 85 | # return _hasil; 86 | #})(); 87 | 88 | sayur_sayuran = ['brokoli', 'bayam', 'kemangi'] 89 | makan sayuran for sayuran in sayur_sayuran when sayuran isnt 'kemangi' 90 | #=>sayur_sayuran = ['brokoli', 'bayam', 'kemangi']; 91 | # 92 | #for (_k = 0, _len2 = sayur_sayuran.length; _k < _len2; _k++) { 93 | # sayuran = sayur_sayuran[_k]; 94 | # if (sayuran !== 'kemangi') { 95 | # makan(sayuran); 96 | # } 97 | #} 98 | ``` 99 | 100 | ## Referensi Tambahan 101 | 102 | - [Smooth CoffeeScript (EN)](http://autotelicum.github.io/Smooth-CoffeeScript/) 103 | - [CoffeeScript Ristretto (EN)](https://leanpub.com/coffeescript-ristretto/read) 104 | -------------------------------------------------------------------------------- /id/hq9+.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Alexey Nazaroff", "https://github.com/rogaven"] 4 | translators: 5 | - ["Haydar Ali Ismail", "http://github.com/haydarai"] 6 | --- 7 | 8 | HQ9+ adalah bahasa pemrograman gurauan yang dibuat oleh Cliff Biffle. Bahasa 9 | ini hanya memiliki empat perintah dan tidak memenuhi Turing-complete. 10 | 11 | ``` 12 | Hanya ada 4 perintah, masing-masing direpresentasikan oleh karakter berikut 13 | H: mencetak "Hello, world!" 14 | Q: mencetak kode sumber dari program ini (Quine) 15 | 9: mencetak lirik dari lagu "99 Bottles of Beer" 16 | +: menambah nilai satu ke akumulator (nilai dari akumulator tidak dapat 17 | diakses) 18 | Karakter lain akan dihiraukan. 19 | 20 | Ok. Mari kita menulis beberapa program: 21 | HQ9 22 | 23 | Hasil: 24 | Hello world! 25 | HQ9 26 | 27 | HQ9+ sangat sederhana, tetapi membuat anda bisa melakukan hal yang sangat sulit 28 | dilakukan di bahasa lain. Sebagai contoh, berikut sebuah program yang 29 | menciptakan tiga salinan dirinya sendiri ke layar: 30 | QQQ 31 | 32 | Ini menghasilakn: 33 | QQQ 34 | QQQ 35 | QQQ 36 | ``` 37 | 38 | Dan itu semuanya. Ada banyak interpreters untuk HQ9+. Kamu bisa menemukannya di 39 | bawah 40 | 41 | + [Salah satu interpreter online](https://almnet.de/esolang/hq9plus.php) 42 | + [Website resmi HQ9+](http://cliffle.com/esoterica/hq9plus.html) 43 | -------------------------------------------------------------------------------- /id/json.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Anna Harren", "https://github.com/iirelu"] 4 | - ["Marco Scannadinari", "https://github.com/marcoms"] 5 | translators: 6 | - ["Rizky Luthfianto", "https://github.com/rilut"] 7 | - ["Ahmad Zafrullah", "https://github.com/23Pstars"] 8 | --- 9 | 10 | JSON adalah format pertukaran data yang sangat sederhana. Sebagaimana dikutip dari [json.org](http://json.org), JSON mudah untuk dibaca atau ditulis oleh manusia, dan mudah diuraikan dan diproses oleh mesin. 11 | 12 | Sebuah format JSON setidaknya memiliki: 13 | * Sebuah pasangan nama atau nilai dinyatakan dengan karakter (`{ }`). Dibeberapa bahasa pemrograman, karakter ini sering digunakan sebagai object, record, struct, dictionary, hash table, keyed list, atau associative array. 14 | * Daftar nilai dinyatakan dengan karakter (`[ ]`). Dibeberapa bahasa pemrograman, karakter ini sering digunakan sebagai array, vector, list, atau sequence. 15 | 16 | Format JSON murni tidak memiliki komentar, namun beberapa pengurai (parser) dapat mengenali komentar seperti yang digunakan oleh bahasa C (`//`, `/**/`). Beberapa pengurai lainnya juga memiliki toleransi terhadap akhiran sisa koma (seperti koma yang terdapat pada akhir elemen dari larik atau properti terakhir dari objek), tapi koma tersebut memang seharusnya diabaikan untuk dukungan yang lebih baik. 17 | 18 | Dalam tutorial ini, semuanya menggunakan format JSON murni. 19 | 20 | Tipe data yang didukung oleh JSON: 21 | 22 | * Teks: `"halo"`, `"\"tanda petik.\""`, `"\u0abe"`, `"baris baru.\n"` 23 | * Angka: `23`, `0.11`, `12e10`, `3.141e-10`, `1.23e+4` 24 | * Objek: `{ "kunci": "nilai" }` 25 | * Larik: `["nilai"]` 26 | * Lainnya: `true`, `false`, `null` 27 | 28 | ```json 29 | { 30 | "kunci": "nilai", 31 | 32 | "kunci": "harus selalu diapit tanda kutip", 33 | "angka": 0, 34 | "strings": "Halø, dunia. Semua karaktor unicode diperbolehkan, terumasuk \"escaping\".", 35 | "punya tipe data boolean?": true, 36 | "nilai kosong": null, 37 | 38 | "angka besar": 1.2e+100, 39 | 40 | "obyek": { 41 | "komentar": "Most of your structure will come from objects.", 42 | 43 | "array": [0, 1, 2, 3, "Array bisa berisi apapun.", 5], 44 | 45 | "obyek lainnya": { 46 | "komentar": "Obyek-obyek JSON dapat dibuat bersarang, sangat berguna." 47 | } 48 | }, 49 | 50 | "iseng-iseng": [ 51 | { 52 | "sumber potassium": ["pisang"] 53 | }, 54 | [ 55 | [1, 0, 0, 0], 56 | [0, 1, 0, 0], 57 | [0, 0, 1, "neo"], 58 | [0, 0, 0, 1] 59 | ] 60 | ], 61 | 62 | "gaya alternatif": { 63 | "komentar": "lihat ini!" 64 | , "posisi tanda koma": "tak masalah. selama sebelum nilai berikutnya, valid-valid saja" 65 | , "komentar lainnya": "betapa asyiknya" 66 | }, 67 | 68 | "singkat": "Dan Anda selesai! Sekarang Anda tahu apa saja yang disediakan oleh JSON." 69 | } 70 | ``` 71 | 72 | ## Referensi lebih labjut 73 | 74 | * [JSON.org](http://json.org/json-id.html) semua keindahan JSON dijelaskan dalam bentuk alur-grafis (bahasa indonesia). 75 | -------------------------------------------------------------------------------- /id/pyqt.md: -------------------------------------------------------------------------------- 1 | --- 2 | filename: learnqt.py 3 | contributors: 4 | - ["Nathan Hughes", "https://github.com/sirsharpest"] 5 | translators: 6 | - ["Rizky Luthfianto", "http://github.com/rilut"] 7 | --- 8 | 9 | **Qt** adalah framework terkenal untuk pengembangan perangkat lunak *cross-platform* yang dapat dijalankan pada berbagai platform perangkat lunak dan perangkat keras dengan sedikit atau tanpa perubahan dalam kode, dengan tetap memiliki kekuatan dan kecepatan aplikasi *native*. **Qt** ditulis dalam bahasa C++. 10 | 11 | 12 | Tulisan ini diadaptasi dari **Intro Qt untuk C++** oleh [Aleksey Kholovchuk](https://github.com/vortexxx192). Kode-kode yang tertulis di sini akan menghasilkan fungsionalitas yang sama. Bedanya, versi ini dibangun menggunakan **PyQt**! 13 | 14 | ```python 15 | import sys 16 | from PyQt4 import QtGui 17 | 18 | def window(): 19 | # Buat objek aplikasi 20 | app = QtGui.QApplication(sys.argv) 21 | # Buat sebuah widget, sebagai tempat di mana label kita akan ditempatkan 22 | w = QtGui.QWidget() 23 | # Tambahkan label untuk widget 24 | b = QtGui.QLabel(w) 25 | # Set teks untuk label 26 | b.setText("Halo, Dunia!") 27 | # Set parameter penempatan dan ukuran 28 | w.setGeometry(100, 100, 200, 50) 29 | b.move(50, 20) 30 | # Set judul pada jendela 31 | w.setWindowTitle("PyQt") 32 | # Tampilkan segalanya 33 | w.show() 34 | # Jalankan apa yang telah kita atur. Setelah semua selesai kita atur. 35 | sys.exit(app.exec_()) 36 | 37 | if __name__ == '__main__': 38 | window() 39 | ``` 40 | 41 | Untuk menunjukkan beberapa fitur yang lebih canggih di **PyQt**, kita akan membangun elemen tambahan. 42 | Di sini, kita akan membuat Kotak Popup Dialog, yang berguna untuk meminta pengguna untuk mengkonfirmasi keputusan atau untuk menampilkan informasi. 43 | 44 | ```python 45 | import sys 46 | from PyQt4.QtGui import * 47 | from PyQt4.QtCore import * 48 | 49 | 50 | def window(): 51 | app = QApplication(sys.argv) 52 | w = QWidget() 53 | # Buat tombol b dan tempelkan pada widget w 54 | b = QPushButton(w) 55 | b.setText("Tekan aku!") 56 | b.move(50, 50) 57 | # Perintahkan tombol b untuk memanggil fungsi ini ketika diklik 58 | # Perhatikan bahwa kita tidak menggunakan simbol "()" pada pemanggilan fungsi kali ini 59 | b.clicked.connect(ShowDialog) 60 | w.setWindowTitle("Dialog PyQt") 61 | w.show() 62 | sys.exit(app.exec_()) 63 | 64 | # Fungsi ini akan membuat jendela dialog dengan tombol 65 | # yang menunggu untuk diklik untuk keluar dari program 66 | def ShowDialog(): 67 | d = QDialog() 68 | b1 = QPushButton("ok", d) 69 | b1.move(50, 50) 70 | d.setWindowTitle("Dialog") 71 | # Modalitas ini memberitahu popup untuk memblokir induk saat ini aktif 72 | d.setWindowModality(Qt.ApplicationModal) 73 | # Pada klik, kita ingin seluruh proses untuk berhenti 74 | b1.clicked.connect(sys.exit) 75 | d.exec_() 76 | 77 | if __name__ == '__main__': 78 | window() 79 | ``` 80 | -------------------------------------------------------------------------------- /images/cairo/build.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adambard/learnxinyminutes-docs/377af91af275c4b5a5def6d39e44ca32cf35d639/images/cairo/build.png -------------------------------------------------------------------------------- /images/cairo/connect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adambard/learnxinyminutes-docs/377af91af275c4b5a5def6d39e44ca32cf35d639/images/cairo/connect.png -------------------------------------------------------------------------------- /images/cairo/connect2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adambard/learnxinyminutes-docs/377af91af275c4b5a5def6d39e44ca32cf35d639/images/cairo/connect2.png -------------------------------------------------------------------------------- /images/cairo/declare.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adambard/learnxinyminutes-docs/377af91af275c4b5a5def6d39e44ca32cf35d639/images/cairo/declare.png -------------------------------------------------------------------------------- /images/cairo/deploy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adambard/learnxinyminutes-docs/377af91af275c4b5a5def6d39e44ca32cf35d639/images/cairo/deploy.png -------------------------------------------------------------------------------- /images/solidity/copy-address.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adambard/learnxinyminutes-docs/377af91af275c4b5a5def6d39e44ca32cf35d639/images/solidity/copy-address.png -------------------------------------------------------------------------------- /images/solidity/metamask-kovan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adambard/learnxinyminutes-docs/377af91af275c4b5a5def6d39e44ca32cf35d639/images/solidity/metamask-kovan.png -------------------------------------------------------------------------------- /images/solidity/remix-add-token.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adambard/learnxinyminutes-docs/377af91af275c4b5a5def6d39e44ca32cf35d639/images/solidity/remix-add-token.png -------------------------------------------------------------------------------- /images/solidity/remix-choose-file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adambard/learnxinyminutes-docs/377af91af275c4b5a5def6d39e44ca32cf35d639/images/solidity/remix-choose-file.png -------------------------------------------------------------------------------- /images/solidity/remix-compile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adambard/learnxinyminutes-docs/377af91af275c4b5a5def6d39e44ca32cf35d639/images/solidity/remix-compile.png -------------------------------------------------------------------------------- /images/solidity/remix-deploy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adambard/learnxinyminutes-docs/377af91af275c4b5a5def6d39e44ca32cf35d639/images/solidity/remix-deploy.png -------------------------------------------------------------------------------- /images/solidity/remix-interact.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adambard/learnxinyminutes-docs/377af91af275c4b5a5def6d39e44ca32cf35d639/images/solidity/remix-interact.png -------------------------------------------------------------------------------- /images/solidity/remix-solidity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adambard/learnxinyminutes-docs/377af91af275c4b5a5def6d39e44ca32cf35d639/images/solidity/remix-solidity.png -------------------------------------------------------------------------------- /images/solidity/remix-testnet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adambard/learnxinyminutes-docs/377af91af275c4b5a5def6d39e44ca32cf35d639/images/solidity/remix-testnet.png -------------------------------------------------------------------------------- /images/solidity/send-link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adambard/learnxinyminutes-docs/377af91af275c4b5a5def6d39e44ca32cf35d639/images/solidity/send-link.png -------------------------------------------------------------------------------- /it/coffeescript.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Luca 'Kino' Maroni", "http://github.com/kino90"] 4 | - ["Tenor Biel", "http://github.com/L8D"] 5 | - ["Xavier Yao", "http://github.com/xavieryao"] 6 | --- 7 | 8 | CoffeeScript è un piccolo linguaggio che compila direttamente nell'equivalente 9 | JavaScript, non c'è nessuna interpretazione a runtime. Come possibile 10 | successore di JavaScript, CoffeeScript fa il suo meglio per restituire 11 | un codice leggibile, ben stampato e performante in ogni ambiente JavaScript. 12 | 13 | Guarda anche [il sito di CoffeeScript](http://coffeescript.org/), che ha una 14 | guida completa a CoffeeScript. 15 | 16 | ```coffeescript 17 | # CoffeeScript è un linguaggio hipster. 18 | # Segue le mode di alcuni linguaggi moderni. 19 | # Quindi i commenti sono come quelli di Ruby e Python, usano il cancelletto. 20 | 21 | ### 22 | I blocchi di commenti sono definiti con tre cancelletti, che vengono tradotti 23 | direttamente in `/*` e `*/` nel codice JavaScript risultante. 24 | 25 | Prima di continuare devi conoscere la maggior parte 26 | delle semantiche JavaScript. 27 | ### 28 | 29 | # Assegnamento: 30 | numero = 42 #=> var numero = 42; 31 | contrario = true #=> var contrario = true; 32 | 33 | # Condizioni: 34 | numero = -42 if contrario #=> if(contrario) { numero = -42; } 35 | 36 | # Funzioni: 37 | quadrato = (x) -> x * x #=> var quadrato = function(x) { return x * x; } 38 | 39 | riempi = (contenitore, liquido = "caffè") -> 40 | "Sto riempiendo #{contenitore} con #{liquido}..." 41 | #=>var riempi; 42 | # 43 | #riempi = function(contenitore, liquido) { 44 | # if (liquido == null) { 45 | # liquido = "caffè"; 46 | # } 47 | # return "Sto riempiendo " + contenitore + " con " + liquido + "..."; 48 | #}; 49 | 50 | # Intervalli: 51 | lista = [1..5] #=> var lista = [1, 2, 3, 4, 5]; 52 | 53 | # Oggetti: 54 | matematica = 55 | radice: Math.sqrt 56 | quadrato: quadrato 57 | cubo: (x) -> x * quadrato x 58 | #=> var matematica = { 59 | # "radice": Math.sqrt, 60 | # "quadrato": quadrato, 61 | # "cubo": function(x) { return x * quadrato(x); } 62 | # } 63 | 64 | # Splats: 65 | gara = (vincitore, partecipanti...) -> 66 | print vincitore, partecipanti 67 | #=>gara = function() { 68 | # var partecipanti, vincitore; 69 | # vincitore = arguments[0], partecipanti = 2 <= arguments.length ? __slice.call(arguments, 1) : []; 70 | # return print(vincitore, partecipanti); 71 | # }; 72 | 73 | # Esistenza: 74 | alert "Lo sapevo!" if elvis? 75 | #=> if(typeof elvis !== "undefined" && elvis !== null) { alert("Lo sapevo!"); } 76 | 77 | # Comprensione degli Array: 78 | cubi = (matematica.cubo num for num in lista) 79 | #=>cubi = (function() { 80 | # var _i, _len, _results; 81 | # _results = []; 82 | # for (_i = 0, _len = lista.length; _i < _len; _i++) { 83 | # num = lista[_i]; 84 | # _results.push(matematica.cubo(num)); 85 | # } 86 | # return _results; 87 | # })(); 88 | 89 | cibi = ['broccoli', 'spinaci', 'cioccolato'] 90 | mangia cibo for cibo in cibi when cibo isnt 'cioccolato' 91 | #=>cibi = ['broccoli', 'spinaci', 'cioccolato']; 92 | # 93 | #for (_k = 0, _len2 = cibi.length; _k < _len2; _k++) { 94 | # cibo = cibi[_k]; 95 | # if (cibo !== 'cioccolato') { 96 | # mangia(cibo); 97 | # } 98 | #} 99 | ``` 100 | 101 | ## Altre risorse 102 | 103 | - [Smooth CoffeeScript](http://autotelicum.github.io/Smooth-CoffeeScript/) 104 | - [CoffeeScript Ristretto](https://leanpub.com/coffeescript-ristretto/read) 105 | -------------------------------------------------------------------------------- /it/dynamic-programming.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Akashdeep Goel", "http://github.com/akashdeepgoel"] 4 | translators: 5 | - ["Ale46", "https://github.com/ale46"] 6 | --- 7 | 8 | # Programmazione dinamica 9 | 10 | ## Introduzione 11 | 12 | La programmazione dinamica è una tecnica potente utilizzata per risolvere una particolare classe di problemi, come vedremo. L'idea è molto semplice, se hai risolto un problema con l'input dato, salva il risultato come riferimento futuro, in modo da evitare di risolvere nuovamente lo stesso problema. 13 | 14 | Ricordate sempre! 15 | "Chi non ricorda il passato è condannato a ripeterlo" 16 | 17 | ## Modi per risolvere questi problemi 18 | 19 | 1. *Top-Down* : Inizia a risolvere il problema specifico suddividendolo. Se vedi che il problema è già stato risolto, rispondi semplicemente con la risposta già salvata. Se non è stato risolto, risolvilo e salva la risposta. Di solito è facile da pensare e molto intuitivo. Questo è indicato come Memoization. 20 | 21 | 2. *Bottom-Up* : Analizza il problema e vedi l'ordine in cui i sotto-problemi sono risolti e inizia a risolvere dal sottoproblema banale, verso il problema dato. In questo processo, è garantito che i sottoproblemi vengono risolti prima di risolvere il problema. Si parla di programmazione dinamica. 22 | 23 | ## Esempio di programmazione dinamica 24 | 25 | Il problema di "Longest Increasing Subsequence" consiste nel trovare la sottosequenza crescente più lunga di una determinata sequenza. Data una sequenza `S= {a1 , a2 , a3, a4, ............., an-1, an }` dobbiamo trovare il sottoinsieme più lungo tale che per tutti gli `j` e gli `i`, `j a[j] and LS[i] 28 | 29 | 文書の開始 30 | ``` 31 | 32 | 複数の著者 33 | 34 | ``` 35 | = 文書タイトル 36 | John Doe ; Jane Doe; Black Beard 37 | 38 | 複数の著者による文書の始まり。 39 | ``` 40 | 41 | 版(著者の行を必要とします) 42 | 43 | ``` 44 | = 第一版のタイトル 45 | 芋男 46 | v1.0, 2016-01-13 47 | 48 | このポテトについての文書は面白いです。 49 | ``` 50 | 51 | 段落 52 | 53 | ``` 54 | 段落は特別なことは不要です。 55 | 56 | 空行を段落の間に入れることで、段落を分けることができます。 57 | 58 | 折り返しをしたい場合、+ 59 | を書くことで折り返せます! 60 | ``` 61 | 62 | 文書の整形 63 | 64 | ``` 65 | _アンダースコアで斜体になります。_ 66 | *アスタリスクで太字になります。* 67 | *_組み合わせると楽しい_* 68 | `バッククォートで固定幅になります。` 69 | `*太字の固定幅*` 70 | ``` 71 | 72 | 節タイトル 73 | 74 | ``` 75 | = Level 0 (文書のヘッダーにのみ使用してください) 76 | 77 | == Level 1

78 | 79 | === Level 2

80 | 81 | ==== Level 3

82 | 83 | ===== Level 4

84 | ``` 85 | 86 | リスト 87 | 88 | 箇条書きリストを作るには、アスタリスクを使用してください。 89 | 90 | ``` 91 | * foo 92 | * bar 93 | * baz 94 | ``` 95 | 96 | 番号付きリストを作るには、ピリオドを使用してください。 97 | 98 | ``` 99 | . item 1 100 | . item 2 101 | . item 3 102 | ``` 103 | 104 | リストはアスタリスクやピリオドを追加することで5段階まで入れ子にできます。 105 | 106 | ``` 107 | * foo 1 108 | ** foo 2 109 | *** foo 3 110 | **** foo 4 111 | ***** foo 5 112 | 113 | . foo 1 114 | .. foo 2 115 | ... foo 3 116 | .... foo 4 117 | ..... foo 5 118 | ``` 119 | 120 | ## 補足資料 121 | 122 | AsciiDocの文書を処理するツールは2種類あります。 123 | 124 | 1. [AsciiDoc](http://asciidoc.org/): オリジナルのPython実装で、Linuxで利用可能です。現在は開発されておらず、メンテナンスのみの状態です。 125 | 2. [Asciidoctor](http://asciidoctor.org/): Rubyによる別実装で、JavaやJavaScriptでも利用可能です。AsciiDocに新しい機能や出力形式を追加するため、現在活発に開発されています。 126 | 127 | 以下のリンクは `AsciiDoctor` 実装関連のものです。 128 | 129 | * [Markdown - AsciiDoc syntax comparison](http://asciidoctor.org/docs/user-manual/#comparison-by-example): Common MarkdownとAsciidocの要素を並べて比較しています。 130 | * [Getting started](http://asciidoctor.org/docs/#get-started-with-asciidoctor): インストールから簡潔な文書を作るための簡単なガイドです。 131 | * [Asciidoctor User Manual](http://asciidoctor.org/docs/user-manual/): 文法のリファレンス、例、描画ツール、その他を含む完全なドキュメントです。 132 | -------------------------------------------------------------------------------- /json.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: JSON 3 | filename: learnjson.json 4 | contributors: 5 | - ["Anna Harren", "https://github.com/iirelu"] 6 | - ["Marco Scannadinari", "https://github.com/marcoms"] 7 | - ["himanshu", "https://github.com/himanshu81494"] 8 | - ["Michael Neth", "https://github.com/infernocloud"] 9 | - ["Athanasios Emmanouilidis", "https://github.com/athanasiosem"] 10 | --- 11 | 12 | JSON is an extremely simple data-interchange format. As [json.org](https://json.org) says, it is easy for humans to read and write and for machines to parse and generate. 13 | 14 | A piece of JSON can be any value of the types listed later, but in practice almost always represents either: 15 | 16 | * A collection of name/value pairs (`{ }`). In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array. 17 | * An ordered list of values (`[ ]`). In various languages, this is realized as an array, vector, list, or sequence. 18 | 19 | JSON in its purest form has no actual comments, but most parsers will accept C-style (`//`, `/* */`) comments. Some parsers also tolerate a trailing comma (i.e. a comma after the last element of an array or the after the last property of an object), but they should be avoided for better compatibility. 20 | 21 | For the purposes of this tutorial, everything is going to be 100% valid JSON. Luckily, it kind of speaks for itself. 22 | 23 | Supported data types: 24 | 25 | * Strings: `"hello"`, `"\"A quote.\""`, `"\u0abe"`, `"Newline.\n"` 26 | * Numbers: `23`, `0.11`, `12e10`, `3.141e-10`, `1.23e+4` 27 | * Objects: `{ "key": "value" }` 28 | * Arrays: `["Values"]` 29 | * Miscellaneous: `true`, `false`, `null` 30 | 31 | ```json 32 | { 33 | "key": "value", 34 | 35 | "keys": "must always be enclosed in double quotes", 36 | "numbers": 0, 37 | "strings": "Hellø, wørld. All unicode is allowed, along with \"escaping\".", 38 | "has bools?": true, 39 | "nothingness": null, 40 | 41 | "big number": 1.2e+100, 42 | 43 | "objects": { 44 | "comment": "Most of your structure will come from objects.", 45 | 46 | "array": [0, 1, 2, 3, "Arrays can have anything in them.", 5], 47 | 48 | "another object": { 49 | "comment": "These things can be nested, very useful." 50 | } 51 | }, 52 | 53 | "silliness": [ 54 | { 55 | "sources of potassium": ["bananas"] 56 | }, 57 | [ 58 | [1, 0, 0, 0], 59 | [0, 1, 0, 0], 60 | [0, 0, 1, "neo"], 61 | [0, 0, 0, 1] 62 | ] 63 | ], 64 | 65 | "alternative style": { 66 | "comment": "check this out!" 67 | , "comma position": "doesn't matter, if it's before the next key, it's valid" 68 | , "another comment": "how nice" 69 | }, 70 | 71 | 72 | 73 | "whitespace": "Does not matter.", 74 | 75 | 76 | 77 | "that was short": "And done. You now know everything JSON has to offer." 78 | } 79 | ``` 80 | 81 | ## Further Reading 82 | 83 | * [JSON.org](https://json.org) All of JSON beautifully explained using flowchart-like graphics. 84 | * [JSON Tutorial](https://www.youtube.com/watch?v=wI1CWzNtE-M) A concise introduction to JSON. 85 | -------------------------------------------------------------------------------- /ko/bf.md: -------------------------------------------------------------------------------- 1 | --- 2 | filename: learnbf.bf 3 | contributors: 4 | - ["Prajit Ramachandran", "http://prajitr.github.io/"] 5 | - ["Mathias Bynens", "http://mathiasbynens.be/"] 6 | translators: 7 | - ["JongChan Choi", "http://0xABCDEF.com/"] 8 | - ["Peter Lee", "http://peterjlee.com/"] 9 | --- 10 | 11 | Brainfuck(문장을 시작하는 단어가 아닌이상 첫글자는 대문자를 사용하지 않습니다)은 12 | 여덟가지 명령어만으로 튜링-완전한 최소주의 프로그래밍 언어입니다. 13 | 14 | ```bf 15 | "><+-.,[]" 이외의 문자들은 무시됩니다. (쌍따옴표는 제외) 16 | 17 | 브레인퍽은 30,000 칸 짜리의 0으로 초기화된 배열과, 18 | 현재 칸을 가르키는 포인터로 표현됩니다. 19 | 20 | 여덟가지의 명령어는 다음과 같습니다: 21 | + : 포인터가 가르키는 현재 칸의 값을 1 증가시킵니다. 22 | - : 포인터가 가르키는 현재 칸의 값을 1 감소시킵니다. 23 | > : 포인터가 다음 칸(오른쪽 칸)을 가르키도록 이동시킵니다. 24 | < : 포인터가 이전 칸(왼쪽 칸)을 가르키도록 이동시킵니다. 25 | . : 현재 칸의 값을 ASCII 문자로 출력합니다. (즉, 65 = 'A') 26 | , : 하나의 문자를 입력받고 그 값을 현재 칸에 대입합니다. 27 | [ : 현재 칸의 값이 0이면 짝이 맞는 ] 명령으로 넘어갑니다. 28 | 0이 아니면 다음 명령어로 넘어갑니다. 29 | ] : 현재 칸의 값이 0이면 다음 명령어로 넘어갑니다. 30 | 0이 아니면 짝이 맞는 [ 명령으로 다시 돌아갑니다. 31 | 32 | [이랑 ]은 while 루프를 만들어냅니다. 무조건, 짝이 맞아야 합니다. 33 | 34 | 몇가지 간단한 브레인퍽 프로그램을 보겠습니다. 35 | 36 | ++++++ [ > ++++++++++ < - ] > +++++ . 37 | 38 | 이 프로그램은 문자 'A'를 출력합니다. 처음에는, 반복할 횟수를 정하기 위한 값을 39 | 만들기 위해 첫번째 칸의 값을 6으로 증가시킵니다. 그리고 루프로 들어가서([) 40 | 두번째 칸으로 넘어갑니다. 루프 안에서는 두번째 칸의 값을 10 증가시키고, 41 | 다시 첫번째 칸으로 넘어가서 값을 1 감소시킵니다. 이 루프는 여섯번 돕니다. 42 | (첫번째 칸의 값을 6번 감소시켜서 0이 될 때 까지는 ] 명령을 만날 때마다 43 | 루프의 시작 지점으로 돌아갑니다) 44 | 45 | 이 시점에서, 두번째 칸의 값은 60이고, 포인터는 값이 0인 첫번째 칸에 위치합니다. 46 | 여기서 두번째 칸으로 넘어간 다음 값을 5 증가시키면 두번째 칸의 값이 65가 되고, 47 | 65는 문자 'A'에 대응하는 아스키 코드이기 때문에, 두번째 칸의 값을 출력하면 48 | 터미널에 'A'가 출력됩니다. 49 | 50 | , [ > + < - ] > . 51 | 52 | 이 프로그램은 사용자로부터 문자 하나를 입력받아 첫번째 칸에 집어넣습니다. 53 | 그리고 루프에 들어가서, 두번째 칸으로 넘어가 값을 한 번 증가시킨 다음, 54 | 다시 첫번째 칸으로 넘어가서 값을 한 번 감소시킵니다. 55 | 이는 첫번째 칸의 값이 0이 될 때까지 지속되며, 56 | 두번째 칸은 첫번째 칸이 갖고있던 값을 가지게 됩니다. 57 | 루프가 종료되면 포인터는 첫번째 칸을 가르키기 때문에 두번째 칸으로 넘어가고, 58 | 해당 아스키 코드에 대응하는 문자를 출력합니다. 59 | 60 | 또한 공백문자는 순전히 가독성을 위해서 작성되었다는 것을 기억하세요. 61 | 다음과 같이 작성해도 똑같이 돌아갑니다: 62 | 63 | ,[>+<-]>. 64 | 65 | 한 번 돌려보고 아래의 프로그램이 실제로 무슨 일을 하는지 맞춰보세요: 66 | 67 | ,>,< [ > [ >+ >+ << -] >> [- << + >>] <<< -] >> 68 | 69 | 이 프로그램은 두 개의 숫자를 입력받은 뒤, 그 둘을 곱합니다. 70 | 71 | 위 코드는 일단 두 번의 입력을 받고, 첫번째 칸의 값만큼 바깥 루프를 돕니다. 72 | 그리고 루프 안에서 다시 두번째 칸의 값만큼 안쪽의 루프를 돕니다. 73 | 그리고 그 루프에서는 세번째 칸의 값을 증가시키는데, 문제가 하나 있습니다: 74 | 내부 루프가 한 번 끝나게 되면 두번째 칸의 값은 0이 됩니다. 75 | 그럼 다시 바깥 루프를 돌 때에 안쪽의 루프를 돌지 않게 되는데, 이를 해결하려면 76 | 네번째 칸의 값도 같이 증가시킨 다음, 그 값을 두번째 칸으로 옮기면 됩니다. 77 | 그러면 세번째 칸에 곱셈의 결과가 남습니다. 78 | ``` 79 | 80 | 여기까지 브레인퍽이었습니다. 참 쉽죠? 81 | 재미삼아 브레인퍽 프로그램이나 다른 언어로 브레인퍽 인터프리터를 작성해보세요. 82 | 인터프리터 구현은 간단한 편인데, 83 | 사서 고생하는 것을 즐기는 편이라면 한 번 작성해보세요… 브레인퍽으로. 84 | -------------------------------------------------------------------------------- /ko/coffeescript.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Tenor Biel", "http://github.com/L8D"] 4 | translators: 5 | - ["wikibook", "http://wikibook.co.kr"] 6 | --- 7 | 8 | ``` coffeescript 9 | # 커피스크립트(CoffeeScript)는 최신 유행을 따르는 언어입니다. 10 | # 커피스크립트는 여러 현대 언어의 트렌드를 따르는데, 11 | # 그래서 주석을 작성할 때는 루비나 파이썬과 같이 해시를 씁니다. 12 | 13 | ### 14 | 블록 주석은 이처럼 작성하며, 자바스크립트 코드로 만들어지도록 15 | '/ *'와 '* /'로 직접적으로 변환됩니다. 16 | 17 | 계속하기에 앞서 자바스크립트 시맨틱을 대부분 이해하고 있어야 합니다. 18 | ### 19 | 20 | # 할당: 21 | number = 42 #=> var number = 42; 22 | opposite = true #=> var opposite = true; 23 | 24 | # 조건문: 25 | number = -42 if opposite #=> if(opposite) { number = -42; } 26 | 27 | # 함수: 28 | square = (x) -> x * x #=> var square = function(x) { return x * x; } 29 | 30 | # 범위: 31 | list = [1..5] #=> var list = [1, 2, 3, 4, 5]; 32 | 33 | # 객체: 34 | math = 35 | root: Math.sqrt 36 | square: square 37 | cube: (x) -> x * square x 38 | #=> var math = { 39 | # "root": Math.sqrt, 40 | # "square": square, 41 | # "cube": function(x) { return x * square(x); } 42 | #} 43 | 44 | # 가변 인자(splat): 45 | race = (winner, runners...) -> 46 | print winner, runners 47 | 48 | # 존재 여부 확인: 49 | alert "I knew it!" if elvis? 50 | #=> if(typeof elvis !== "undefined" && elvis !== null) { alert("I knew it!"); } 51 | 52 | # 배열 조건 제시법(comprehensions): 53 | cubes = (math.cube num for num in list) #=> ... 54 | ``` 55 | -------------------------------------------------------------------------------- /ko/json.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Anna Harren", "https://github.com/iirelu"] 4 | - ["Marco Scannadinari", "https://github.com/marcoms"] 5 | - ["himanshu", "https://github.com/himanshu81494"] 6 | - ["Michael Neth", "https://github.com/infernocloud"] 7 | translators: 8 | - ["Wooseop Kim", "https://github.com/linterpreteur"] 9 | --- 10 | 11 | JSON은 아주 간단한 데이터 교환 포맷입니다. [json.org](http://json.org/json-ko.html)에 의하면, 사람이 읽고 쓰기 쉬우며 기계가 분석하고 생성하기 쉽습니다. 12 | 13 | JSON 한 개는 반드시 이하의 둘 중 하나를 나타내야 합니다. 14 | * 이름과 값 쌍의 모임(`{ }`). 이는 다양한 언어에서 객체, 레코드, 구조체, 딕셔너리, 해시 테이블, 키 리스트, 혹은 연관 배열로 구현됩니다. 15 | * 값에 순서가 있는 리스트 (`[ ]`). 이는 다양한 언어에서 배열, 벡터, 리스트, 시퀀스로 구현됩니다. 16 | 17 | 순수한 JSON은 사실 주석이 없지만 대부분의 파서는 C 스타일의 주석(`//`, `/* */`)도 받아들일 겁니다. 일부 파서는 꼬리에 오는 쉼표, 즉 배열의 마지막 원소 혹은 객체의 마지막 속성 다음에 오는 쉼표도 인정하겠지만, 호환성을 위해 쓰지 않는 것이 좋습니다. 18 | 19 | 이 튜토리얼의 목적에 따라 모든 것은 100% 유효한 JSON입니다. 다행스럽게도 JSON은 다소 자기서술적입니다. 20 | 21 | 지원하는 데이터 형: 22 | 23 | * 문자열: `"안녕"`, `"\"따옴표.\""`, `"\u0abe"`, `"개행 문자.\n"` 24 | * 수: `23`, `0.11`, `12e10`, `3.141e-10`, `1.23e+4` 25 | * 객체: `{ "키": "값" }` 26 | * 배열: `["값 값 값"]` 27 | * 기타: `true`, `false`, `null` 28 | 29 | ```json 30 | { 31 | "키": "값", 32 | 33 | "키는": "반드시 큰따옴표 안에 있어야 합니다.", 34 | "수": 0, 35 | "문자열": "Hellø, wørld. 모든 유니코드와 \"탈출 문자\"가 지원됩니다.", 36 | "부울도 있나?": true, 37 | "아무 것도 없는 건": null, 38 | 39 | "큰 수": 1.2e+100, 40 | 41 | "객체": { 42 | "주석": "문서 구조의 대부분은 객체가 될 것입니다.", 43 | 44 | "배열": [0, 1, 2, 3, "배열 안에는 무엇이든 올 수 있습니다.", 5], 45 | 46 | "다른 객체": { 47 | "주석": "객체는 객체를 포함할 수 있습니다. 아주 유용하죠." 48 | } 49 | }, 50 | 51 | "장난이지롱": [ 52 | { 53 | "칼륨이 풍부한": ["바나나"] 54 | }, 55 | [ 56 | [1, 0, 0, 0], 57 | [0, 1, 0, 0], 58 | [0, 0, 1, "neo"], 59 | [0, 0, 0, 1] 60 | ] 61 | ], 62 | 63 | "다른 방식": { 64 | "주석": "여기 보세요!" 65 | , "쉼표의 위치는": "상관 없습니다. 다음 키 전에만 온다면 유효합니다." 66 | , "다른 주석": "참 좋죠" 67 | }, 68 | 69 | "공백은": "상관이 없습니다.", 70 | 71 | "짧았죠": "끝입니다. JSON의 모든 것을 터득하셨습니다." 72 | } 73 | ``` 74 | 75 | ## 더 읽기 76 | 77 | * [JSON.org](http://json.org/json-ko.html) 플로우차트와 같은 그래픽을 이용해 설명한 JSON의 모든 것. 78 | -------------------------------------------------------------------------------- /lint/encoding.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | check_encoding() { 4 | file="$1" 5 | encoding=$(file -b --mime-encoding "$file") 6 | 7 | # Check if the encoding is neither UTF-8 nor US-ASCII 8 | if [[ "$encoding" != "utf-8" && "$encoding" != "us-ascii" ]]; then 9 | # Print the file path and encoding 10 | echo "Error: $file has encoding $encoding, which is not utf-8 or us-ascii" 11 | return 1 12 | fi 13 | 14 | # Check for UTF-8 BOM 15 | if [[ "$encoding" == "utf-8" ]]; then 16 | if head -c 3 "$file" | cmp -s <(echo -ne '\xEF\xBB\xBF'); then 17 | echo "Error: $file contains a UTF-8 BOM" 18 | return 1 19 | fi 20 | fi 21 | 22 | return 0 23 | } 24 | 25 | export -f check_encoding 26 | 27 | # Default to current directory if no argument is given 28 | directory="${1:-.}" 29 | 30 | find "$directory" -type f -name "*.md" -print0 | xargs -0 -P 8 -I {} bash -c 'check_encoding "$@"' _ {} 31 | -------------------------------------------------------------------------------- /lint/requirements.txt: -------------------------------------------------------------------------------- 1 | yamllint 2 | pyyaml 3 | -------------------------------------------------------------------------------- /lt/json.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Zygimantus", "https://github.com/zygimantus"] 4 | --- 5 | 6 | JSON („džeisonas“) yra itin paprastas duomenų mainų formatas, todėl tai bus pati lengviausia „Learn X in Y Minutes“ pamoka. 7 | 8 | JSON savo gryniausioje formoje neturi jokių komentarų, tačiau dauguma analizatorių priimtų C stiliaus komentarus (`//`, `/* */`). Kai kurie analizatoriai taip pat toleruoja gale esantį kablelį, pvz., kablelis po kiekvieno masyvo paskutinio elemento arba po paskutinio objekto lauko, tačiau jų reikėtų vengti dėl geresnio suderinamumo. 9 | 10 | JSON reikšmė privalo būti skaičius, eilutė, masyvas, objektas arba viena reikšmė iš šių: true, false, null. 11 | 12 | Palaikančios naršyklės yra: Firefox 3.5+, Internet Explorer 8.0+, Chrome 1.0+, Opera 10.0+, and Safari 4.0+. 13 | 14 | Failo plėtinys JSON failams yra „.json“, o MIME tipas yra „application/json“. 15 | 16 | Dauguma programavimo kalbų palaiko JSON duomenų serializaciją (kodavimą) ir deserializaciją (dekodavimą) į natyviasias duomenų struktūras. JavaScript turi visišką JSON teksto kaip duomenų manipuliavimo palaikymą. 17 | 18 | Daugiau informacijos galima rasti [json.org](http://www.json.org/) 19 | 20 | JSON yra pastatytas iš dviejų struktūrų: 21 | 22 | * Vardų/reikšmių porų rinkinys. Daugomoje kalbų, tai yra realizuojama kaip objektas, įrašas, struktūra, žodynas, hash lentelė, sąrašas su raktais arba asociatyvusis masyvas. 23 | * Rūšiuotas reikšmių sąrašas. Daugumoje kalbų, toks sąrašas yra realizuojama kaip masyvas, vektorius, sąrašas arba seka. 24 | 25 | Objektas su įvairiomis vardo/reikšmės poromis. 26 | 27 | ```json 28 | { 29 | "raktas": "reikšmė", 30 | 31 | "raktai": "privalo visada būti uždaryti dvigubomis kabutėmis", 32 | "skaičiai": 0, 33 | "eilutės": "Labas, pasauli. Visas unikodas yra leidžiamas, kartu su \"vengimu\".", 34 | "turi logiką?": true, 35 | "niekas": null, 36 | 37 | "didelis skaičius": 1.2e+100, 38 | 39 | "objektai": { 40 | "komentaras": "Dauguma tavo struktūrų ateis iš objektų.", 41 | 42 | "masyvas": [0, 1, 2, 3, "Masyvas gali turėti bet ką savyje.", 5], 43 | 44 | "kitas objektas": { 45 | "komentaras": "Šie dalykai gali būti įdedami naudingai." 46 | } 47 | }, 48 | 49 | "kvailumas": [ 50 | { 51 | "kalio šaltiniai": ["bananai"] 52 | }, 53 | [ 54 | [1, 0, 0, 0], 55 | [0, 1, 0, 0], 56 | [0, 0, 1, "neo"], 57 | [0, 0, 0, 1] 58 | ] 59 | ], 60 | 61 | "alternativus stilius": { 62 | "komentaras": "tik pažiūrėk!" 63 | , "kablelio padėti": "nesvarbi - kol jis prieš kitą raktą, tada teisingas" 64 | , "kitas komentaras": "kaip gražu" 65 | } 66 | } 67 | ``` 68 | 69 | Paprastas reikšmių masyvas pats savaime yra galiojantis JSON. 70 | 71 | ```json 72 | [1, 2, 3, "tekstas", true] 73 | ``` 74 | 75 | Objektai taip pat gali būti masyvų dalis. 76 | 77 | ```json 78 | [{"vardas": "Jonas", "amžius": 25}, {"vardas": "Eglė", "amžius": 29}, {"vardas": "Petras", "amžius": 31}] 79 | ``` 80 | -------------------------------------------------------------------------------- /ms/coffeescript.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Tenor Biel", "http://github.com/L8D"] 4 | - ["Xavier Yao", "http://github.com/xavieryao"] 5 | translators: 6 | - ["hack1m", "https://github.com/hack1m"] 7 | --- 8 | 9 | CoffeeScript adalah bahasa kecil yang menyusun/kompil satu-per-satu menjadi setara JavaScript, dan tidak ada interpretasi di runtime. 10 | Sebagai salah satu pengganti kepada JavaScript, CoffeeScript mencuba yang terbaik untuk output kod JavaScript yang mudah dibaca, cantik-dicetak dan berfungsi lancar, yang mana berfungsi baik pada setiap runtime JavaScript. 11 | 12 | Lihat juga [Laman sesawang CoffeeScript](http://coffeescript.org/), yang mana ada tutorial lengkap untuk CoffeeScript. 13 | 14 | ```coffeescript 15 | # CoffeeScript adalah bahasa hipster. 16 | # Ia beredar mengikut trend kebanyakkan bahasa moden. 17 | # Jadi komen sama seperti Ruby dan Python, ia menggunakan simbol nombor. 18 | 19 | ### 20 | Blok komen seperti ini, dan ia terjemah terus ke '/ *'s dan '* /'s 21 | untuk keputusan kod JavaScript. 22 | 23 | Sebelum meneruskan anda perlu faham kebanyakkan daripada 24 | JavaScript adalah semantik. 25 | ### 26 | 27 | # Menetapkan: 28 | number = 42 #=> var number = 42; 29 | opposite = true #=> var opposite = true; 30 | 31 | # Bersyarat: 32 | number = -42 if opposite #=> if(opposite) { number = -42; } 33 | 34 | # Fungsi: 35 | square = (x) -> x * x #=> var square = function(x) { return x * x; } 36 | 37 | fill = (container, liquid = "coffee") -> 38 | "Filling the #{container} with #{liquid}..." 39 | #=>var fill; 40 | # 41 | #fill = function(container, liquid) { 42 | # if (liquid == null) { 43 | # liquid = "coffee"; 44 | # } 45 | # return "Filling the " + container + " with " + liquid + "..."; 46 | #}; 47 | 48 | # Julat: 49 | list = [1..5] #=> var list = [1, 2, 3, 4, 5]; 50 | 51 | # Objek: 52 | math = 53 | root: Math.sqrt 54 | square: square 55 | cube: (x) -> x * square x 56 | #=> var math = { 57 | # "root": Math.sqrt, 58 | # "square": square, 59 | # "cube": function(x) { return x * square(x); } 60 | # }; 61 | 62 | # Splats: 63 | race = (winner, runners...) -> 64 | print winner, runners 65 | #=>race = function() { 66 | # var runners, winner; 67 | # winner = arguments[0], runners = 2 <= arguments.length ? __slice.call(arguments, 1) : []; 68 | # return print(winner, runners); 69 | # }; 70 | 71 | # Kewujudan: 72 | alert "I knew it!" if elvis? 73 | #=> if(typeof elvis !== "undefined" && elvis !== null) { alert("I knew it!"); } 74 | 75 | # Pemahaman array: 76 | cubes = (math.cube num for num in list) 77 | #=>cubes = (function() { 78 | # var _i, _len, _results; 79 | # _results = []; 80 | # for (_i = 0, _len = list.length; _i < _len; _i++) { 81 | # num = list[_i]; 82 | # _results.push(math.cube(num)); 83 | # } 84 | # return _results; 85 | # })(); 86 | 87 | foods = ['broccoli', 'spinach', 'chocolate'] 88 | eat food for food in foods when food isnt 'chocolate' 89 | #=>foods = ['broccoli', 'spinach', 'chocolate']; 90 | # 91 | #for (_k = 0, _len2 = foods.length; _k < _len2; _k++) { 92 | # food = foods[_k]; 93 | # if (food !== 'chocolate') { 94 | # eat(food); 95 | # } 96 | #} 97 | ``` 98 | 99 | ## Sumber tambahan 100 | 101 | - [Smooth CoffeeScript](http://autotelicum.github.io/Smooth-CoffeeScript/) 102 | - [CoffeeScript Ristretto](https://leanpub.com/coffeescript-ristretto/read) 103 | -------------------------------------------------------------------------------- /nl/json.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Anna Harren", "https://github.com/iirelu"] 4 | - ["Marco Scannadinari", "https://github.com/marcoms"] 5 | - ["himanshu", "https://github.com/himanshu81494"] 6 | - ["Maarten Jacobs", "https://github.com/maartenJacobs"] 7 | translators: 8 | - ["Niels van Velzen", "https://nielsvanvelzen.me"] 9 | --- 10 | 11 | Gezien JSON een zeer eenvouding formaat heeft zal dit één van de simpelste 12 | Learn X in Y Minutes ooit zijn. 13 | 14 | JSON heeft volgens de specificaties geen commentaar. Ondanks dat hebben de 15 | meeste parsers support voor C-stijl (`//`, `/* */`) commentaar. 16 | Sommige parsers staan zelfs trailing komma's toe. 17 | (Een komma na het laatste element in een array of achter de laatste eigenschap van een object). 18 | Het is wel beter om dit soort dingen te vermijden omdat het niet in elke parser zal werken. 19 | 20 | In het voorbeeld zal alleen 100% geldige JSON gebruikt worden. 21 | 22 | Data types gesupport door JSON zijn: nummers, strings, booleans, arrays, objecten en null. 23 | Gesupporte browsers zijn: Firefox(Mozilla) 3.5, Internet Explorer 8, Chrome, Opera 10, Safari 4. 24 | De extensie voor JSON bestanden is ".json". De MIME type is "application/json". 25 | Enkele nadelen van JSON zijn het gebrek aan type definities en een manier van DTD. 26 | 27 | ```json 28 | { 29 | "sleutel": "waarde", 30 | 31 | "sleutels": "zijn altijd in quotes geplaatst", 32 | "nummers": 0, 33 | "strings": "Hallø, wereld. Alle unicode karakters zijn toegestaan, samen met \"escaping\".", 34 | "boolean": true, 35 | "niks": null, 36 | 37 | "groot nummer": 1.2e+100, 38 | 39 | "objecten": { 40 | "commentaar": "In JSON gebruik je vooral objecten voor je strutuur", 41 | 42 | "array": [0, 1, 2, 3, "Arrays kunnen alles in zich hebben.", 5], 43 | 44 | "nog een object": { 45 | "commentaar": "Objecten kunnen genest worden, erg handig." 46 | } 47 | }, 48 | 49 | "dwaasheid": [ 50 | { 51 | "bronnen van kalium": ["bananen"] 52 | }, 53 | [ 54 | [1, 0, 0, 0], 55 | [0, 1, 0, 0], 56 | [0, 0, 1, "neo"], 57 | [0, 0, 0, 1] 58 | ] 59 | ], 60 | 61 | "alternatieve stijl": { 62 | "commentaar": "Kijk dit!" 63 | , "De komma positie": "maakt niet uit zolang het er maar is" 64 | , "nog meer commentaar": "wat leuk" 65 | }, 66 | 67 | "dat was kort": "En nu ben je klaar, dit was alles wat je moet weten over JSON." 68 | } 69 | ``` 70 | -------------------------------------------------------------------------------- /no/json.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Ole Mathias Heggem", "https://github.com/msbone"] 4 | - ["Anna Harren", "https://github.com/iirelu"] 5 | - ["Marco Scannadinari", "https://github.com/marcoms"] 6 | --- 7 | 8 | JSON er en enkel tekstbasert standard for datautveksling. 9 | Den er opprinnelig avledet fra JavaScript for å representere enkle datastrukturer. 10 | Standarden er imidlertid uavhengig av JavaScript eller andre programmeringsspråk. 11 | 12 | JSON i sin reneste form har ingen faktiske kommentarer, men de fleste parsere vil akseptere 13 | C-stil (`//`, `/* */`) kommentarer. 14 | 15 | ```json 16 | { 17 | "nøkkel": "verdi", 18 | 19 | "nøkler": "må alltid være i doble anførselstegn", 20 | "tall": 0, 21 | "strings": "Hellø, wørld. Alt unicode er godkjent, også \"escaping\".", 22 | "har bools?": true, 23 | "ingenting": null, 24 | 25 | "stort tall": 1.2e+100, 26 | 27 | "objekt": { 28 | "kommentar": "Meste av strukturen kommer ifra objekt.", 29 | 30 | "array": [0, 1, 2, 3, "Arrays kan inneholde alt.", 5], 31 | 32 | "nytt object": { 33 | "comment": "Ny kommentar" 34 | } 35 | }, 36 | 37 | "tull": [ 38 | { 39 | "Kilde til Kalium": ["bananer"] 40 | }, 41 | [ 42 | [1, 0, 0, 0], 43 | [0, 1, 0, 0], 44 | [0, 0, 1, "neo"], 45 | [0, 0, 0, 1] 46 | ] 47 | ], 48 | 49 | "Alternativ": { 50 | "Kommentar": "Sjekk ut ditta!" 51 | , "plassering av komma": "Sålenge den er før verdien er det gyldig" 52 | , "Enda en kommentar": "TØFT!" 53 | }, 54 | 55 | "Ferdig": "Da er den korte innledninga til JSON ferdig" 56 | } 57 | ``` 58 | -------------------------------------------------------------------------------- /openscad.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: OpenSCAD 3 | filename: learnopenscad.scad 4 | contributors: 5 | - ["Tom Preston", "https://github.com/tompreston/"] 6 | --- 7 | 8 | Draw 3D models with code using [OpenSCAD](https://openscad.org/). 9 | 10 | ```openscad 11 | // Comments look like this 12 | 13 | // 3D Primitives 14 | cube(10); 15 | cube([5, 10, 20]); 16 | sphere(10); 17 | 18 | // Transformations 19 | translate([20, 0, 0]) cube(10); 20 | rotate([0, 20, 30]) cube(10); 21 | 22 | translate([20, 0, 0]) rotate([0, 20, 30]) cube(10); 23 | rotate([0, 20, 30]) translate([20, 0, 0]) cube(10); 24 | 25 | // Modifiers 26 | // 27 | // * disable 28 | // ! show only 29 | // # highlight / debug 30 | // % transparent / background 31 | // 32 | // For example, show only the rotated cube at the origin, before we translate it. 33 | translate([20, 0, 0]) !rotate([0, 20, 30]) cube(10); 34 | 35 | // Formatting 36 | // The following models are the same. The official docs prefer the second. 37 | rotate([0, 20, 30]) translate([20, 0, 0]) cube(10); 38 | 39 | rotate([0, 20, 30]) 40 | translate([20, 0, 0]) 41 | cube(10); 42 | 43 | rotate([0, 20, 30]) { 44 | translate([20, 0, 0]) { 45 | cube(10); 46 | } 47 | } 48 | 49 | // Loops 50 | num_cubes = 5; 51 | r = 20; 52 | cube_len = 5; 53 | 54 | for (i = [0:num_cubes]) { 55 | echo(str("Plot cube ", i)); 56 | rotate([0, i * 360 / num_cubes, 0]) 57 | translate([r, 0, 0]) 58 | cube(cube_len, center=true); 59 | } 60 | 61 | // Boolean operations 62 | // 63 | // union() - the sum of both shapes 64 | // difference() - the first shape, minus the second shape 65 | // intersection() - only parts of both shapes which intersect 66 | // 67 | cube_l = 20; 68 | cube_w = 10; 69 | cube_h = 10; 70 | 71 | hole_pos_l = 10; 72 | hole_pos_h = 5; 73 | hole_r = 3; 74 | 75 | difference() { 76 | cube([cube_l, cube_w, cube_h]); 77 | translate([hole_pos_l, 0, hole_pos_h]) 78 | rotate([-90, 0, 0]) 79 | cylinder(cube_w, r=hole_r); 80 | } 81 | 82 | // Functions calculate values 83 | function inch2mm(i) = i * 25.4; 84 | 85 | cube(inch2mm(2)); 86 | 87 | // Modules create objects you want to use later 88 | module house(roof="flat", paint=[1,0,0]) { 89 | color(paint) 90 | if (roof=="flat") { 91 | translate([0,-1,0]) cube(); 92 | } else if (roof=="pitched") { 93 | rotate([90,0,0]) 94 | linear_extrude(height=1) 95 | polygon(points=[[0,0],[0,1],[0.5,1.5],[1,1],[1,0]]); 96 | } 97 | else if (roof=="domical") { 98 | translate([0,-1,0]) { 99 | translate([0.5,0.5,1]) 100 | sphere(r=0.5,$fn=20); 101 | cube(); 102 | } 103 | } 104 | } 105 | 106 | house("pitched"); 107 | translate([2, 0, 0]) house("domical"); 108 | 109 | // Import modules and function from other files 110 | include // Import the content of the file as if they were written in this file 111 | use // Import modules and functions, but do not execute any commands 112 | ``` 113 | 114 | ## Further Reading 115 | 116 | * Official docs [openscad.org/documentation.html](https://openscad.org/documentation.html) 117 | * Cheat sheet [openscad.org/cheatsheet/index.html](https://openscad.org/cheatsheet/index.html) 118 | * Vim bindings [github.com/sirtaj/vim-openscad](https://github.com/sirtaj/vim-openscad) 119 | -------------------------------------------------------------------------------- /pets.csv: -------------------------------------------------------------------------------- 1 | name,age,weight,species 2 | "fluffy",3,14,"cat" 3 | "vesuvius",6,23,"fish" 4 | "rex",5,34,"dog" 5 | -------------------------------------------------------------------------------- /pl/json.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Anna Harren", "https://github.com/iirelu"] 4 | - ["Marco Scannadinari", "https://github.com/marcoms"] 5 | - ["himanshu", "https://github.com/himanshu81494"] 6 | - ["Michael Neth", "https://github.com/infernocloud"] 7 | translators: 8 | - ["Michał Mitrosz", "https://github.com/Voltinus"] 9 | --- 10 | 11 | JSON to bardzo prosty format wymiany danych. Jak jest napisane na [json.org](http://json.org), jest łatwy do pisania i czytania dla ludzi i do parsowania i generowania dla maszyn. 12 | 13 | Kod JSON musi zawierać któreś z poniższych: 14 | * Zbiór par nazwa/wartość (`{ }`). W różnych językach jest to obiekt, rekord, struktura, słownik, tablica mieszająca, lista z kluczami, lub tablica asocjacyjna. 15 | * Uporządkowana lista wartości (`[ ]`). W różnych językach jest to tablica, wektor, lista, lub sekwencja. 16 | tablica/lista/sekwencja (`[ ]`) lub słownik/obiekt/tablica asocjacyjna (`{ }`). 17 | 18 | JSON w swojej czystej postaci nie ma komentarzy, ale większość parserów akceptuje komentarze w stylu C (`//`, `/* */`). Niektóre parsery pozwalają także na końcowy przecinek (np. przecinek po ostatnim elemencie w tablicy lub po ostatiej własności obiektu), ale powinien on być omijany dla lepszej kompatybilności. 19 | 20 | Dla celów tego poradnika wszystko będzie 100% kodem JSON. Na szczęście, to samo mówi za siebie. 21 | 22 | Wspierane typy danych: 23 | 24 | * Łańcuchy znaków: `"witaj"`, `"\"Cytat.\""`, `"\u0abe"`, `"Nowa linia.\n"` 25 | * Liczby: `23`, `0.11`, `12e10`, `3.141e-10`, `1.23e+4` 26 | * Obiekty: `{ "klucz": "wartość" }` 27 | * Tablice: `["Wartości"]` 28 | * Inne: `true`, `false`, `null` 29 | 30 | ```json 31 | { 32 | "klucz": "wartość", 33 | 34 | "klucze": "muszą być zawsze zamknięte w podwójnych cudzysłowach", 35 | "liczby": 0, 36 | "łańcuchy": "Hellø, wørld. Wszystkie znaki unicode są dozwolone, razem z \"sekwencjami escape\".", 37 | "wartości logiczne?": true, 38 | "nic": null, 39 | 40 | "duża liczba": 1.2e+100, 41 | 42 | "obiekty": { 43 | "komentarz": "Większość twojej struktury będzie zbudowana z obiektów.", 44 | 45 | "tablica": [0, 1, 2, 3, "Tablice mogą mieć wewnątrz cokolwiek", 5], 46 | 47 | "inny obiekt": { 48 | "komentarz": "Elementy mogą się w sobie zawierać, bardzo użyteczne" 49 | } 50 | }, 51 | 52 | "głupota": [ 53 | { 54 | "źródła potasu": ["banany"] 55 | }, 56 | [ 57 | [1, 0, 0, 0], 58 | [0, 1, 0, 0], 59 | [0, 0, 1, "neo"], 60 | [0, 0, 0, 1] 61 | ] 62 | ], 63 | 64 | "styl alternatywny": { 65 | "komentarz": "sprawdź to!" 66 | , "pozycja przecinka": "nie ma znaczenia, o ile jest przed następnym kluczem, jest poprawnie" 67 | , "następny komentarz": "jak ładnie" 68 | }, 69 | 70 | 71 | 72 | "znaki białe": "nie mają znaczenia", 73 | 74 | 75 | 76 | "to było krótkie": "I gotowe. Wiesz już wszystko o formacie JSON." 77 | } 78 | ``` 79 | 80 | ## Dalsza lektura 81 | 82 | * [JSON.org](http://json.org) Cały JSON pięknie wytłumaczony na podstawie grafik przypominających schematy blokowe. 83 | -------------------------------------------------------------------------------- /pt-br/asciidoc.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Ryan Mavilia", "http://unoriginality.rocks/"] 4 | translators: 5 | - ["David Lima", "https://github.com/davelima"] 6 | --- 7 | 8 | AsciiDoc é uma linguagem de marcação similar ao Markdown e pode ser 9 | usada para qualquer coisa, de livros até blogs. Criada em 2002 por 10 | Stuart Rackham, a linguagem é simples mas facilita muito a customização. 11 | 12 | Cabeçalho do documento 13 | 14 | Cabeçalhos são opcionais e não podem conter linhas em branco. 15 | Devem estar separados do conteúdo com pelo menos uma linha em branco. 16 | 17 | Apenas Título 18 | 19 | ``` 20 | = Título do documento 21 | 22 | Primeira sentência do documento. 23 | ``` 24 | 25 | Título e Autor 26 | 27 | ``` 28 | = Título do Documento 29 | Nome Sobrenome 30 | 31 | Início do documento. 32 | ``` 33 | 34 | Múltiplos Autores 35 | 36 | ``` 37 | = Título do Documento 38 | John Doe ; Jane Doe; Black Beard 39 | 40 | Início do documento com múltiplos autores. 41 | ``` 42 | 43 | Linhas de revisão (requer uma linha de autor) 44 | 45 | ``` 46 | = Documento V1 47 | Potato Man 48 | v1.0, 2016-01-13 49 | 50 | Este artigo sobre batatas será divertido. 51 | ``` 52 | 53 | Parágrafos 54 | 55 | ``` 56 | Você não precisa fazer nada especial para criar um parágrafo. 57 | 58 | Adicione uma linha em branco entre os parágrafos para separá-los. 59 | 60 | Para criar uma linha em branco adicione um + 61 | e você terá uma quebra de linha! 62 | ``` 63 | 64 | Formatando texto 65 | 66 | ``` 67 | _underscore é itálico_ 68 | *asterisco é negrito* 69 | *_você pode combinar efeitos_* 70 | `use crase para fonte monoespaçada` 71 | `*fonte monoespaçada em negrito*` 72 | ``` 73 | 74 | Título de seções 75 | 76 | ``` 77 | = Nível 0 (Use apenas no cabeçalho do documento) 78 | 79 | == Nível 1

80 | 81 | === Nível 2

82 | 83 | ==== Nível 3

84 | 85 | ===== Nível 4

86 | ``` 87 | 88 | Listas 89 | 90 | Para criar uma lista com marcadores use asteriscos. 91 | 92 | ``` 93 | * foo 94 | * bar 95 | * baz 96 | ``` 97 | 98 | Para criar uma lista numerada use pontos. 99 | 100 | ``` 101 | . item 1 102 | . item 2 103 | . item 3 104 | ``` 105 | 106 | Você pode criar listas dentro de listas adicionando 107 | asteriscos ou pontos extras em até 5 níveis. 108 | 109 | ``` 110 | * foo 1 111 | ** foo 2 112 | *** foo 3 113 | **** foo 4 114 | ***** foo 5 115 | 116 | . foo 1 117 | .. foo 2 118 | ... foo 3 119 | .... foo 4 120 | ..... foo 5 121 | ``` 122 | -------------------------------------------------------------------------------- /pt-br/bc.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Btup"] 4 | translators: 5 | - ["David Lima", "https://github.com/davelima"] 6 | --- 7 | ```bc 8 | /*Este é um comentário 9 | multi-linhas*/ 10 | # Este é um comentário de uma única linha! (em bc GNU). 11 | 12 | /*1. Variáveis e estruturas de controle*/ 13 | num = 45 /*Todas as variáveis apenas salvam dados do tipo double, e 14 | você não pode salvar strings diretamente em constantes.*/ 15 | num 45; /*Você pode adicionar ponto-e-vírgula após cada linha. 16 | Isto é opcional*/ 17 | /*Blocos são denotados usando os operadores {} (similar ao C):*/ 18 | while(num < 50) { 19 | num += 1 /*equivalente a num=num+1. 20 | a = a op b é equivalente a a op= b.*/ 21 | } 22 | /*E existem os operadores ++ (incrementar) e -- (decrementar).*/ 23 | /* Existem 3 tipos especiais de variáveis: 24 | scale: define a escala de números double. 25 | ibase: define a base de da entrada. 26 | obase: define a base da saída. 27 | */ 28 | /*Cláusulas If:*/ 29 | hora = read() /*Lê a entrada de um número*/ 30 | 31 | if(hora < 12) { /*Os operadores são idênticos ao C.*/ 32 | print "Bom dia\n" /*"print" imprime strings ou variáveis 33 | separados por vírgula (,).*/ 34 | } else if(hora == 12) { 35 | print "Olá\n" 36 | /*Para escapar strings, inicie a string com \. 37 | Para deixar o escape de strings mais claros, 38 | aqui está uma lista simplificada das strings escapadas 39 | que funcionarão com bc: 40 | \b: backspace 41 | \c: carriage return (enter) 42 | \n: newline (nova linha) 43 | \t: tab 44 | \\: backslash (barra inertida)*/ 45 | } else { 46 | /*Variáveis são globais por padrão.*/ 47 | istoEGlobal = 5 48 | /*Para tornar uma variável local, use a palavra-chave "auto" em uma função.*/ 49 | } 50 | 51 | /*Todas as variáveis por padrão tem o valor 0*/ 52 | num = variavelEmBranco /*num é igual a 0.*/ 53 | 54 | /*Assim como no C, "0" é considerado "false"*/ 55 | if(!num) {print "false\n"} 56 | 57 | /*Diferente do C, bc não tem o operador ?:. Por exemplo, 58 | este bloco de código causaria um erro: 59 | a = (num) ? 1 : 0 60 | Entretanto, você pode simular da seguinte forma: 61 | a = (num) && (1) || (0) /*&& é "E", || é "OU"*/ 62 | */ 63 | 64 | /*Loops For*/ 65 | num = 0 66 | for(i = 1; i <= 100; i++) {/*Similar ao loop For do C.*/ 67 | num += i 68 | } 69 | 70 | /*2.Funções e arrays*/ 71 | define fac(n) { /*para definir uma função, use "define".*/ 72 | if(n == 1 || n == 0) { 73 | return 1 /*retorna um valor*/ 74 | } 75 | return n * fac(n - 1) /*recursão é permitido*/ 76 | } 77 | 78 | /*Closures e funções anônimas não são permitidas*/ 79 | 80 | num = fac(4) /*24*/ 81 | 82 | /*Exemplo de variáveis locais:*/ 83 | define x(n) { 84 | auto x 85 | x = 1 86 | return n + x 87 | } 88 | x(3) /*4*/ 89 | print x /*A variável "x" não será acessível de fora da função*/ 90 | /*Arrays são equivalentes aos arrays em C.*/ 91 | for(i = 0; i <= 3; i++) { 92 | a[i] = 1 93 | } 94 | /*Para acessar um array, faça assim:*/ 95 | print a[0], " ", a[1], " ", a[2], " ", a[3], "\n" 96 | quit /*Adicione essa linha no final do código 97 | para garantir que o programa encerre. Essa linha é opcional.*/ 98 | ``` 99 | 100 | Aproveite bem essa simples calculadora! (Ou essa linguagem de programação, para ser exato.) 101 | 102 | Este programa inteiro foi escrito em GNU bc. Para rodá-lo, use ```bc learnbc-pt.bc``` 103 | -------------------------------------------------------------------------------- /pt-br/emacs.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Joseph Riad", "https://github.com/Joseph-Riad"] 4 | translators: 5 | - ["André de Santa Gabriel", "https://github.com/andredesanta"] 6 | --- 7 | 8 | O Emacs começou sua vida como [gnu.org/software/emacs/emacs-paper.html](https://www.gnu.org/software/emacs/emacs-paper.html) e cresceu 9 | ao longo dos anos em um ecossistema completo. Muitas tarefas, geralmente 10 | relegado a um conjunto diversificado de ferramentas pode ser realizado de dentro 11 | Emacs em uma interface consistente e familiar. Exemplos incluem 12 | gerenciamento de diretório, visualização de documentos PDF, edição de arquivos via SSH, gerenciamento de 13 | repos git. Em suma, o Emacs é seu para fazer 14 | o que você quiser: o espectro de usuários varia daqueles que o usam para 15 | editar arquivos de texto para puristas extremos que o usam para substituir virtualmente seu 16 | sistema operacional. 17 | 18 | O Emacs é extensível através de um dialeto especializado do Lisp conhecido como Emacs 19 | Lisp (Elisp), que possui muitas macros voltadas para a edição de texto e 20 | gerenciamento de buffers de texto. Qualquer tecla (combinação) usada no Emacs está vinculada 21 | para uma função Emacs Lisp e pode ser remapeado para qualquer outra função, 22 | incluindo aqueles que você escreve 23 | você mesmo. 24 | 25 | # Conceitos básicos de Emacs 26 | 27 | Aqui, discuto alguns conceitos e terminologia básicos do Emacs que podem ser 28 | confusos para os recém-chegados (especialmente para as pessoas acostumadas à terminologia do Vim): 29 | 30 | - O texto que o Emacs está editando é conhecido como **buffer** 31 | - Um buffer não corresponde necessariamente a um arquivo real no disco. Pode ser apenas texto na memória. 32 | - Quando um buffer corresponde a um arquivo no disco, dizemos que o buffer está **visitando** esse arquivo. 33 | - O Emacs normalmente possui muitos buffers abertos ao mesmo tempo. 34 | - A exibição do Emacs pode ser dividida em diferentes **windows**. 35 | - Uma janela do sistema operacional para o Emacs é chamada de **frame**. Assim, quando o manual do Emacs fala sobre a abertura de um novo frame, esse essencialmente significa abrir uma nova janela do SO contendo uma (outra) instância do Emacs. 36 | - Os conceitos convencionalmente conhecidos como recortar e colar são referido como **killing** e **yanking**, respectivamente no Emacs. 37 | - A posição atual do cursor é chamada de **point** no Emacs. Tecnicamente, **point** é definido como a posição imediatamente antes do caractere onde o cursor está atualmente. 38 | - Finalmente, cada buffer pode ter vários **modes** associados: o **major mode** e possivelmente vários **minor modes**. 39 | - O **major mode** define o principal comportamento do Emacs no buffer atualmente selecionado. Isso pode ser pensado como o tipo de arquivo. Por exemplo, se você estiver editando um arquivo Python, os principais modes é (por padrão) `python-mode`, que faz com que o Emacs destaque a sintaxe Python e idente automaticamente seus blocos de código conforme exigido sintaticamente pelo seu código Python. 40 | - **Minor modes** definem mudanças sutis no comportamento e várias alterações menores Os modos podem estar ativos ao mesmo tempo no mesmo buffer. Um exemplo menor modo é o modo flyspell, que destaca automaticamente os erros de ortografia no seu buffer. 41 | 42 | # Recursos adicionais 43 | 44 | - [The GNU Emacs Manual](https://www.gnu.org/software/emacs/manual/emacs.html) 45 | - [Emacs Stack Exchange](https://emacs.stackexchange.com/) 46 | - [Emacs Wiki](https://www.emacswiki.org/emacs/EmacsWiki) 47 | -------------------------------------------------------------------------------- /pt-br/json.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Anna Harren", "https://github.com/iirelu"] 4 | - ["Marco Scannadinari", "https://github.com/marcoms"] 5 | - ["Francisco Marques", "https://github.com/ToFran"] 6 | translators: 7 | - ["Miguel Araújo", "https://github.com/miguelarauj1o"] 8 | --- 9 | 10 | Como JSON é um formato de intercâmbio de dados, este será, muito provavelmente, o 11 | "Learn X in Y minutes" mais simples existente. 12 | 13 | JSON na sua forma mais pura não tem comentários, mas a maioria dos analisadores 14 | aceitarão comentários no estilo C (//, /\* \*/). No entanto estes devem ser evitados para otimizar a compatibilidade. 15 | 16 | Um valor JSON pode ser um número, uma string, um array, um objeto, um booleano (true, false) ou null. 17 | 18 | Os browsers suportados são: Firefox 3.5+, Internet Explorer 8.0+, Chrome 1.0+, Opera 10.0+, e Safari 4.0+. 19 | 20 | A extensão dos ficheiros JSON é “.json” e o tipo de mídia de Internet (MIME) é “application/json”. 21 | 22 | Mais informação em: [json.org](http://www.json.org/) 23 | 24 | ```json 25 | { 26 | "chave": "valor", 27 | 28 | "chaves": "deve ser sempre entre aspas (junto ou separado)", 29 | "números": 0, 30 | "strings": "Olá, mundo. Todo o padrão UNICODE é permitido, junto com \"escapando\".", 31 | "possui booleano?": true, 32 | "nada": null, 33 | 34 | "número grande": 1.2e+100, 35 | 36 | "objetos": { 37 | "comentário": "A maior parte da sua estrutura virá de objetos.", 38 | 39 | "array": [0, 1, 2, 3, "Arrays podem ter qualquer coisa em si.", 5], 40 | 41 | "outro objeto": { 42 | "comentário": "Estas coisas podem ser aninhadas, muito úteis." 43 | } 44 | }, 45 | 46 | "tolice": [ 47 | { 48 | "fonte de potássio": ["bananas"] 49 | }, 50 | [ 51 | [1, 0, 0, 0], 52 | [0, 1, 0, 0], 53 | [0, 0, 1, "neo"], 54 | [0, 0, 0, 1] 55 | ] 56 | ], 57 | 58 | "estilo alternativo": { 59 | "comentário": "verificar isso!" 60 | , "posição da vírgula": "não importa - enquanto é antes do valor, então é válido" 61 | , "outro comentário": "que bom" 62 | }, 63 | 64 | "que foi curto": "E, você está feito. Você já sabe tudo que JSON tem para oferecer." 65 | } 66 | ``` 67 | -------------------------------------------------------------------------------- /pt-br/pyqt.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Nathan Hughes", "https://github.com/sirsharpest"] 4 | translators: 5 | - ["Lucas Pugliesi", "https://github.com/fplucas"] 6 | --- 7 | 8 | **Qt** é amplamente conhecido como um framework para desenvolvimento de 9 | software multi-plataforma que pode rodar em várias outras plataformas de 10 | softwares e hardwares com pouca ou nenhuma alteração no código, enquanto mantém 11 | o poder e a velocidade de uma aplicação nativa. Embora o **Qt** tenha sido 12 | originalmente escrito em *C++*. 13 | 14 | 15 | Essa é uma adaptação de uma introdução ao QT em C++ por 16 | [Aleksey Kholovchuk](https://github.com/vortexxx192), alguns dos exemplos de 17 | código podem resultar na mesma funcionalidade que essa versão, apenas usando 18 | o pyqt! 19 | 20 | ```python 21 | import sys 22 | from PyQt4 import QtGui 23 | 24 | def window(): 25 | # Cria um objeto para a aplicação 26 | app = QtGui.QApplication(sys.argv) 27 | # Cria um widget onde o nosso label será inserido 28 | w = QtGui.QWidget() 29 | # Adiciona um label ao widget 30 | b = QtGui.QLabel(w) 31 | # Informa algum texto ao label 32 | b.setText("Hello World!") 33 | # Define os tamanhos e posições dos objetos 34 | w.setGeometry(100, 100, 200, 50) 35 | b.move(50, 20) 36 | # Define o título da janela 37 | w.setWindowTitle("PyQt") 38 | # Exibe a janela 39 | w.show() 40 | # Executa tudo o que foi pedido, apenas uma vez 41 | sys.exit(app.exec_()) 42 | 43 | if __name__ == '__main__': 44 | window() 45 | ``` 46 | 47 | Para utilizar mais funcionalidades no **pyqt** veremos a construção de alguns 48 | outros elementos. 49 | Aqui mostraremos como criar uma janela popup, muito útil para perguntar ao 50 | usuário qual decisão tomar ou exibir alguma informação. 51 | 52 | ```python 53 | import sys 54 | from PyQt4.QtGui import * 55 | from PyQt4.QtCore import * 56 | 57 | 58 | def window(): 59 | app = QApplication(sys.argv) 60 | w = QWidget() 61 | # Cria um botão e o anexa ao widget w 62 | b = QPushButton(w) 63 | b.setText("Press me") 64 | b.move(50, 50) 65 | # Informa b a chamar essa função quando for clicado 66 | # observe que a função chamada não necessita de "()" 67 | b.clicked.connect(showdialog) 68 | w.setWindowTitle("PyQt Dialog") 69 | w.show() 70 | sys.exit(app.exec_()) 71 | 72 | # Essa função deve criar uma janela de diálogo com um botão, 73 | # aguarda ser clicado e encerra o programa 74 | def showdialog(): 75 | d = QDialog() 76 | b1 = QPushButton("ok", d) 77 | b1.move(50, 50) 78 | d.setWindowTitle("Dialog") 79 | # Essa modalidade define que o popup deve bloquear as outras janelas quando ativo 80 | d.setWindowModality(Qt.ApplicationModal) 81 | # Ao ser clicado deve encerrar o processo 82 | b1.clicked.connect(sys.exit) 83 | d.exec_() 84 | 85 | if __name__ == '__main__': 86 | window() 87 | ``` 88 | -------------------------------------------------------------------------------- /pyqt.md: -------------------------------------------------------------------------------- 1 | --- 2 | category: framework 3 | name: PyQt 4 | filename: learnpyqt.py 5 | contributors: 6 | - ["Nathan Hughes", "https://github.com/sirsharpest"] 7 | --- 8 | 9 | **Qt** is a widely-known framework for developing cross-platform software that can be run on various software and hardware platforms with little or no change in the code, while having the power and speed of native applications. Though **Qt** was originally written in *C++*. 10 | 11 | 12 | This is an adaption on the C++ intro to QT by [Aleksey Kholovchuk](https://github.com/vortexxx192 13 | ), some of the code examples should result in the same functionality 14 | this version just having been done using pyqt! 15 | 16 | ```python 17 | import sys 18 | from PyQt4 import QtGui 19 | 20 | def window(): 21 | # Create an application object 22 | app = QtGui.QApplication(sys.argv) 23 | # Create a widget where our label will be placed in 24 | w = QtGui.QWidget() 25 | # Add a label to the widget 26 | b = QtGui.QLabel(w) 27 | # Set some text for the label 28 | b.setText("Hello World!") 29 | # Give some size and placement information 30 | w.setGeometry(100, 100, 200, 50) 31 | b.move(50, 20) 32 | # Give our window a nice title 33 | w.setWindowTitle("PyQt") 34 | # Have everything display 35 | w.show() 36 | # Execute what we have asked for, once all setup 37 | sys.exit(app.exec_()) 38 | 39 | if __name__ == '__main__': 40 | window() 41 | ``` 42 | 43 | In order to get some of the more advanced features in **pyqt** we need to start looking at building additional elements. 44 | Here we show how to introduce a dialog popup box, useful for asking the user to confirm a decision or to provide information. 45 | 46 | ```python 47 | import sys 48 | from PyQt4.QtGui import * 49 | from PyQt4.QtCore import * 50 | 51 | 52 | def window(): 53 | app = QApplication(sys.argv) 54 | w = QWidget() 55 | # Create a button and attach to widget w 56 | b = QPushButton(w) 57 | b.setText("Press me") 58 | b.move(50, 50) 59 | # Tell b to call this function when clicked 60 | # notice the lack of "()" on the function call 61 | b.clicked.connect(showdialog) 62 | w.setWindowTitle("PyQt Dialog") 63 | w.show() 64 | sys.exit(app.exec_()) 65 | 66 | # This function should create a dialog window with a button 67 | # that waits to be clicked and then exits the program 68 | def showdialog(): 69 | d = QDialog() 70 | b1 = QPushButton("ok", d) 71 | b1.move(50, 50) 72 | d.setWindowTitle("Dialog") 73 | # This modality tells the popup to block the parent whilst it's active 74 | d.setWindowModality(Qt.ApplicationModal) 75 | # On click I'd like the entire process to end 76 | b1.clicked.connect(sys.exit) 77 | d.exec_() 78 | 79 | if __name__ == '__main__': 80 | window() 81 | ``` 82 | -------------------------------------------------------------------------------- /ro/coffeescript.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Tenor Biel", "http://github.com/L8D"] 4 | - ["Xavier Yao", "http://github.com/xavieryao"] 5 | translators: 6 | - ["Bogdan Lazar", "http://twitter.com/tricinel"] 7 | --- 8 | 9 | CoffeeScript este un limbaj de programare care este compilat in JavaScript. Nu exista un interpretator la runtime-ul aplicatiei. Fiind unul din successorii JavaScript, CoffeeScript incearca sa compileze JavaScript usor de citit si performant. 10 | 11 | Mai cititi si [website-ul CoffeeScript](http://coffeescript.org/), care contine un tutorial complet Coffeescript. 12 | 13 | ```coffeescript 14 | # CoffeeScript este un limbaj de hipster. 15 | # Se foloseste de trendurile multor limbaje moderne de programare. 16 | # Comentarii sunt ca in Ruby sau Python. 17 | 18 | ### 19 | Comentariile in bloc sunt create cu `###`, iar acestea sunt transformate in `/*` si `*/` pentru JavaScript 20 | 21 | Ar trebuie sa intelegeti JavaScript pentru a continua cu acest ghid. 22 | ### 23 | 24 | # Atribuirea valorilor: 25 | numar = 42 #=> var numar = 42; 26 | opus = true #=> var opus = true; 27 | 28 | # Conditii: 29 | numar = -42 if opus #=> if(opus) { numar = -42; } 30 | 31 | # Functii: 32 | laPatrat = (x) -> x * x #=> var laPatrat = function(x) { return x * x; } 33 | 34 | plin = (recipient, lichid = "cafea") -> 35 | "Umplem #{recipient} cu #{cafea}..." 36 | #=>var plin; 37 | # 38 | #plin = function(recipient, lichid) { 39 | # if (lichid == null) { 40 | # lichid = "cafea"; 41 | # } 42 | # return "Umplem " + recipient + " cu " + lichid + "..."; 43 | #}; 44 | 45 | # Liste: 46 | lista = [1..5] #=> var lista = [1, 2, 3, 4, 5]; 47 | 48 | # Obiecte: 49 | matematica = 50 | radacina: Math.sqrt 51 | laPatrat: laPatrat 52 | cub: (x) -> x * square x 53 | #=> var matematica = { 54 | # "radacina": Math.sqrt, 55 | # "laPatrat": laPatrat, 56 | # "cub": function(x) { return x * square(x); } 57 | # }; 58 | 59 | # Splats: 60 | cursa = (castigator, alergatori...) -> 61 | print castigator, alergatori 62 | #=>cursa = function() { 63 | # var alergatori, castigator; 64 | # castigator = arguments[0], alergatori = 2 <= arguments.length ? __slice.call(arguments, 1) : []; 65 | # return print(castigator, alergatori); 66 | # }; 67 | 68 | # Verificarea existentei: 69 | alert "Stiam eu!" if elvis? 70 | #=> if(typeof elvis !== "undefined" && elvis !== null) { alert("Stiam eu!"); } 71 | 72 | # Operatiuni cu matrice: 73 | cuburi = (math.cube num for num in list) 74 | #=>cuburi = (function() { 75 | # var _i, _len, _results; 76 | # _results = []; 77 | # for (_i = 0, _len = list.length; _i < _len; _i++) { 78 | # num = list[_i]; 79 | # _results.push(math.cube(num)); 80 | # } 81 | # return _results; 82 | # })(); 83 | 84 | alimente = ['broccoli', 'spanac', 'ciocolata'] 85 | mananca aliment for aliment in alimente when aliment isnt 'ciocolata' 86 | #=>alimente = ['broccoli', 'spanac', 'ciocolata']; 87 | # 88 | #for (_k = 0, _len2 = alimente.length; _k < _len2; _k++) { 89 | # aliment = alimente[_k]; 90 | # if (aliment !== 'ciocolata') { 91 | # eat(aliment); 92 | # } 93 | #} 94 | ``` 95 | 96 | ## Resurse aditionale 97 | 98 | - [Smooth CoffeeScript](http://autotelicum.github.io/Smooth-CoffeeScript/) 99 | - [CoffeeScript Ristretto](https://leanpub.com/coffeescript-ristretto/read) 100 | -------------------------------------------------------------------------------- /ro/json.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Anna Harren", "https://github.com/iirelu"] 4 | - ["Marco Scannadinari", "https://github.com/marcoms"] 5 | translators: 6 | - ["Serban Constantin", "https://github.com/fuzzmz"] 7 | --- 8 | 9 | Deoarece JSON este un fromat foarte simplu de schimb de date acesta va fi 10 | probabil cel mai simplu Invata X in Y minute. 11 | 12 | JSON in forma cea mai pura nu contine comentarii insa majoritatea parserelor 13 | vor accepta comentarii in stil C (`//`, `/* */`). Pentru acest caz insa totul 14 | va fi JSON 100% valid. Din fericire codul vorbeste de la sine. 15 | 16 | ```json 17 | { 18 | "cheie": "valoare", 19 | 20 | "chei": "trebuie mereu inconjurate de ghilimele", 21 | "numere": 0, 22 | "stringuri": "Bunã. Tot setul unicode este permis, chiar si \"escaping\".", 23 | "are booleane?": true, 24 | "nimic": null, 25 | 26 | "numere mari": 1.2e+100, 27 | 28 | "obiecte": { 29 | "comentariu": "Majoritatea structurii va veni din obiecte.", 30 | 31 | "vectori": [0, 1, 2, 3, "Vectorii pot avea orice in ei.", 5], 32 | 33 | "alt obiect": { 34 | "comentariu": "Lucrurile pot fi subordonate. Foarte util." 35 | } 36 | }, 37 | 38 | "glumite": [ 39 | { 40 | "surse de potasiu": ["banane"] 41 | }, 42 | [ 43 | [1, 0, 0, 0], 44 | [0, 1, 0, 0], 45 | [0, 0, 1, "neo"], 46 | [0, 0, 0, 1] 47 | ] 48 | ], 49 | 50 | "stil alternativ": { 51 | "comentariu": "ia uite la asta!" 52 | , "pozitia virgulei": "nu conteaza - daca e inaintea valorii atunci e valida" 53 | , "alt comentariu": "ce dragut" 54 | }, 55 | 56 | "a fost scurt": "Am terminat. Acum stii tot ce are JSON de oferit." 57 | } 58 | ``` 59 | -------------------------------------------------------------------------------- /ru/json.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Anna Harren", "https://github.com/iirelu"] 4 | - ["Marco Scannadinari", "https://github.com/marcoms"] 5 | translators: 6 | - ["Dmitry Bessonov", "https://github.com/TheDmitry"] 7 | --- 8 | 9 | JSON - это очень простой формат обмена данными, и это будет самый легкий 10 | курс из когда-либо представленных "Learn X in Y Minutes". 11 | 12 | В чистом виде у JSON нет фактических комментариев, но большинство парсеров примут 13 | комментарии в Си-стиле (//, /\* \*/). Для таких целей, конечно, все правильно 14 | будет на 100% с точки зрения JSON. К счастью, в нашем случае данные скажут сами за себя. 15 | 16 | ```json 17 | { 18 | "ключ": "значение", 19 | 20 | "ключи": "должны всегда заключаться в двойные кавычки", 21 | "числа": 0, 22 | "строки": "Пρивет, миρ. Допускаются все unicode-символы вместе с \"экранированием\".", 23 | "содержит логический тип?": true, 24 | "ничего": null, 25 | 26 | "большое число": 1.2e+100, 27 | 28 | "объекты": { 29 | "комментарий": "Большинство ваших структур будут представлять из себя объекты.", 30 | 31 | "массив": [0, 1, 2, 3, "Массивы могут содержать в себе любой тип.", 5], 32 | 33 | "другой объект": { 34 | "комментарий": "Они могут быть вложенными, и это очень полезно." 35 | } 36 | }, 37 | 38 | "бессмыслие": [ 39 | { 40 | "источники калия": ["бананы"] 41 | }, 42 | [ 43 | [1, 0, 0, 0], 44 | [0, 1, 0, 0], 45 | [0, 0, 1, "нео"], 46 | [0, 0, 0, 1] 47 | ] 48 | ], 49 | 50 | "альтернативный стиль": { 51 | "комментарий": "проверьте это!" 52 | , "позиция запятой": "неважна, хоть и перед значением, все равно правильно" 53 | , "еще один комментарий": "как хорошо" 54 | }, 55 | 56 | "это было недолго": "И вы справились. Теперь вы знаете все о JSON." 57 | } 58 | ``` 59 | -------------------------------------------------------------------------------- /ru/pyqt.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Nathan Hughes", "https://github.com/sirsharpest"] 4 | translators: 5 | - ["Vadim Toptunov", "https://github.com/VadimToptunov"] 6 | --- 7 | 8 | **Qt** - широко известный кросс-платформенный фреймворк для разработки программного обеспечения, 9 | который может быть использован на различных софтварных и хардварных платформах без какого-либо 10 | изменения в коде. Данный фреймворк при этом обладает мощью и скоростью нативных приложений. 11 | Qt и был изначально написан на *C++*. 12 | 13 | Данный текст является адаптацией введения в Qt на C++ под авторством Алексея Ковальчука для pyqt. 14 | 15 | 16 | ```python 17 | def window(): 18 | # Создайте объект приложения 19 | app = QtGui.QApplication(sys.argv) 20 | # Создайте виджет, где будет находиться наш лейбл 21 | w = QtGui.QWidget() 22 | # Добавьте лейбл в виджет 23 | b = QtGui.QLabel(w) 24 | # Задайте текст для лейбла 25 | b.setText("Hello World!") 26 | # Задайте информация о размере и расположении 27 | w.setGeometry(100, 100, 200, 50) 28 | b.move(50, 20) 29 | # Задайте заголовок окна 30 | w.setWindowTitle("PyQt") 31 | # Все ранее написанное выводится на экран 32 | w.show() 33 | # Настройка 34 | sys.exit(app.exec_()) 35 | 36 | if __name__ == '__main__': 37 | window() 38 | ``` 39 | 40 | Для того чтобы получить более продвинутые функции приложения в pyqt, нам необходимо 41 | обратить внимание на создание дополнительных элементов. Ниже представлено создание всплывающего диалогового окна, которое просит пользователя подтвердить его решение или предоставить какую-либо 42 | информацию. 43 | 44 | ```python 45 | import sys 46 | from PyQt4.QtGui import * 47 | from PyQt4.QtCore import * 48 | 49 | 50 | def window(): 51 | app = QApplication(sys.argv) 52 | w = QWidget() 53 | # Создайте кнопку и прикрепите ее к виджету w 54 | b = QPushButton(w) 55 | b.setText("Press me") 56 | b.move(50, 50) 57 | # Укажите b вызвать эту функцию при клике мышкой 58 | # Заметьте, что в вызове функции отсутствуют "()" 59 | b.clicked.connect(showdialog) 60 | w.setWindowTitle("PyQt Dialog") 61 | w.show() 62 | sys.exit(app.exec_()) 63 | 64 | Данная функция должна создавать диалоговое окно с кнопкой, которая ждет клика по себе 65 | и затем завершает программу. 66 | 67 | def showdialog(): 68 | d = QDialog() 69 | b1 = QPushButton("ok", d) 70 | b1.move(50, 50) 71 | d.setWindowTitle("Dialog") 72 | # Эта модальность сообщает всплывающему окну блокировать родительский элемент, пока он активен 73 | d.setWindowModality(Qt.ApplicationModal) 74 | # Процесс завершается по клику мышкой 75 | b1.clicked.connect(sys.exit) 76 | d.exec_() 77 | 78 | if __name__ == '__main__': 79 | window() 80 | ``` 81 | -------------------------------------------------------------------------------- /sk/coffeescript.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Tenor Biel", "http://github.com/L8D"] 4 | - ["Xavier Yao", "http://github.com/xavieryao"] 5 | translators: 6 | - ["Juraj Kostolanský", "http://www.kostolansky.sk"] 7 | --- 8 | 9 | CoffeeScript je jazyk, ktorý sa kompiluje do ekvivalentného JavaScriptu, 10 | neexistuje peňho interpretácia počas behu programu (runtime). 11 | CoffeeScript sa snaží vytvárať čitateľný, pekne formátovaný a optimalizovaný 12 | JavaScriptový kód pracujúci pod každým JavaScriptovým prostredím. 13 | 14 | Pozri tiež [stránku CoffeeScript](http://coffeescript.org/), ktoré obsahuje kompletný tutoriál o CoffeeScripte. 15 | 16 | ```coffeescript 17 | # CoffeeScript je jazyk hipsterov. 18 | # Ide s trendom mnohých moderných jazykov. 19 | # Komentáre sú podobné tým v Ruby a Pythone, používajú symbol #. 20 | 21 | ### 22 | Blokové komentáre vyzerajú takto, prekladajú sa priamo do '/ * ... * /' 23 | pre výsledný kód JavaScriptu. 24 | 25 | Predtým, než budeš pokračovať, mal by si rozumieť sémantike JavaScriptu. 26 | ### 27 | 28 | # Priradenia: 29 | cislo = 42 #=> var cislo = 42; 30 | opak = true #=> var opak = true; 31 | 32 | # Podmienky: 33 | cislo = -42 if opak #=> if(opak) { cislo = -42; } 34 | 35 | # Funkcie: 36 | stvorec = (x) -> x * x #=> var stvorec = function(x) { return x * x; } 37 | 38 | vypln = (nadoba, tekutina = "káva") -> 39 | "#{nadoba} sa napĺňa tekutinou #{tekutina}..." 40 | #=>var vypln; 41 | # 42 | #vypln = function(nadoba, tekutina) { 43 | # if (tekutina == null) { 44 | # tekutina = "káva"; 45 | # } 46 | # return nadoba + " sa napĺňa tekutinou " + tekutina + "..."; 47 | #}; 48 | 49 | # Rozsahy: 50 | zoznam = [1..5] #=> var zoznam = [1, 2, 3, 4, 5]; 51 | 52 | # Objekty: 53 | matika = 54 | zaklad: Math.sqrt 55 | stvorec: square 56 | kocka: (x) -> x * square x 57 | #=> var matika = { 58 | # "zaklad": Math.sqrt, 59 | # "stvorec": square, 60 | # "kocka": function(x) { return x * square(x); } 61 | #} 62 | 63 | # Splat operátor: 64 | zavod = (vitaz, bezci...) -> 65 | print vitaz, bezci 66 | #=>zavod = function() { 67 | # var vitaz, bezci; 68 | # vitaz = arguments[0], 69 | # bezci = 2 <= arguments.length ? __slice.call(arguments, 1) : []; 70 | # return print(vitaz, bezci); 71 | #}; 72 | 73 | # Existencia: 74 | alert "Vedel som to!" if elvis? 75 | #=> if(typeof elvis !== "undefined" && elvis !== null) 76 | # { alert("Vedel som to!"); } 77 | 78 | # Pole: 79 | kocky = (matika.kocka cislo for cislo in zoznam) 80 | #=>kocky = (function() { 81 | # var _i, _len, _results; 82 | # _results = []; 83 | # for (_i = 0, _len = zoznam.length; _i < _len; _i++) { 84 | # cislo = zoznam[_i]; 85 | # _results.push(matika.kocka(cislo)); 86 | # } 87 | # return _results; 88 | # })(); 89 | 90 | jedla = ['brokolica', 'špenát', 'čokoláda'] 91 | zjedz jedlo for jedlo in jedla when jedlo isnt 'čokoláda' 92 | #=>jedla = ['brokolica', 'špenát', 'čokoláda']; 93 | # 94 | #for (_k = 0, _len2 = jedla.length; _k < _len2; _k++) { 95 | # jedlo = jedla[_k]; 96 | # if (jedlo !== 'čokoláda') { 97 | # zjedz(jedlo); 98 | # } 99 | #} 100 | ``` 101 | 102 | ## Ďalšie zdroje 103 | 104 | - [Smooth CoffeeScript](http://autotelicum.github.io/Smooth-CoffeeScript/) 105 | - [CoffeeScript Ristretto](https://leanpub.com/coffeescript-ristretto/read) 106 | -------------------------------------------------------------------------------- /sk/json.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Anna Harren", "https://github.com/iirelu"] 4 | - ["Marco Scannadinari", "https://github.com/marcoms"] 5 | translators: 6 | - ["Juraj Kostolanský", "http://www.kostolansky.sk"] 7 | --- 8 | 9 | Nakoľko je JSON extrémne jednoduchý formát na výmenu dát, toto bude 10 | pravdepodobne najjednoduchšie "Learn X in Y Minutes". 11 | 12 | JSON v jeho základnej forme nemá komentáre, ale veľa parserov akceptuje 13 | komentáre v štýle C (`//`, `/* */`). V tomto návode však bude všetko 14 | 100% valídny JSON. 15 | 16 | ```json 17 | { 18 | "kľúč": "hodnota", 19 | 20 | "kľúč": "musí byť vždy uzavretý v dvojitých uvodzovkách", 21 | "čísla": 0, 22 | "reťazce": "Ahøj, svet. Unicode je povolený pri použití \"únikovej sekvencie (escaping)\".", 23 | "boolean?": true, 24 | "nič": null, 25 | 26 | "veľké číslo": 1.2e+100, 27 | 28 | "objekty": { 29 | "komentár": "Väčšina štruktúry bude pochádzať z objektov.", 30 | 31 | "pole": [0, 1, 2, 3, "Pole môže obsahovať čokoľvek.", 5], 32 | 33 | "iný objekt": { 34 | "komentár": "Môžu byť vhniezdené, čo môže byť užitočné." 35 | } 36 | }, 37 | 38 | "nezmysly": [ 39 | { 40 | "zdroje draslíka": ["banány"] 41 | }, 42 | [ 43 | [1, 0, 0, 0], 44 | [0, 1, 0, 0], 45 | [0, 0, 1, "neo"], 46 | [0, 0, 0, 1] 47 | ] 48 | ], 49 | 50 | "alternatívny štýl": { 51 | "komentár": "sleduj toto!" 52 | , "pozícia čiarky": "nezáleží na nej - pokiaľ je pred hodnotou, všetko je ok" 53 | , "iný komentár": "pekné, že?" 54 | }, 55 | 56 | "to bolo rýchle": "A už sme aj na konci. Teraz ovládš všetko, čo ti JSON môže ponúknuť." 57 | } 58 | ``` 59 | -------------------------------------------------------------------------------- /sl/asciidoc.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Ryan Mavilia", "http://unoriginality.rocks/"] 4 | - ["Abel Salgado Romero", "https://twitter.com/abelsromero"] 5 | translators: 6 | - ["Filip Štamcar", "https://github.com/filips123"] 7 | --- 8 | 9 | AsciiDoc je označevalni jezik, ki je podoben Markdownu in ga je mogoče uporabiti za vse od knjig do spletnih dnevnikov. Jezik, ki ga je leta 2002 ustvaril Stuart Rackham, je preprost, vendar omogoča veliko prilagoditev. 10 | 11 | ## Glava dokumenta 12 | 13 | Glave so neobvezne in ne smejo vsebovati praznih vrstic. Od vsebine jih mora ločiti vsaj ena prazna vrstica. 14 | 15 | ### Naslov 16 | 17 | ``` 18 | = Naslov dokumenta 19 | 20 | Prvi stavek dokumenta. 21 | ``` 22 | 23 | ### Naslov in avtor 24 | 25 | ``` 26 | = Naslov dokumenta 27 | Ime Priimek 28 | 29 | Prvi stavek dokumenta. 30 | ``` 31 | 32 | ### Naslov in več avtorjev 33 | 34 | ``` 35 | = Naslov dokumenta 36 | Ime Priimek ; Janez Novak 37 | 38 | Prvi stavek dokumenta. 39 | ``` 40 | 41 | Vrstica za revizijo 42 | 43 | ``` 44 | = Naslov dokumenta V1 45 | Janez Novak 46 | v1.0, 2016-01-13 47 | 48 | Prvi stavek dokumenta. 49 | ``` 50 | 51 | ## Odstavki 52 | 53 | ``` 54 | Za odstavke ne potrebujete nič posebnega. 55 | 56 | Da jih ločite, dodajte prazno črto med odstavki. 57 | 58 | Če želite ustvariti prazno vrstico, dodajte + 59 | in ustvarili boste prelom vrstice! 60 | ``` 61 | 62 | ## Oblikovanje besedila 63 | 64 | ``` 65 | _podčrtaj za pošvno_ 66 | *zvezdice za krepko* 67 | *_kombinacije za zabavo_* 68 | `krativec za monospace` 69 | `*krepki monospace*` 70 | ``` 71 | 72 | ## Naslovi razdelkov 73 | 74 | ``` 75 | = Stopnja 0 (samo za naslov dokumenta) 76 | 77 | == Stopnja 1

78 | 79 | === Stopnja 2

80 | 81 | ==== Stopnja 3

82 | 83 | ===== Stopnja 4

84 | ``` 85 | 86 | ## Seznami 87 | 88 | Če želite ustvariti neoštevilčen seznam, uporabite zvezdice. 89 | 90 | ``` 91 | * foo 92 | * bar 93 | * baz 94 | ``` 95 | 96 | Če želite ustvaril oštevilčen seznam, uporabite pike. 97 | 98 | ``` 99 | . predmet 1 100 | . predmet 2 101 | . predmet 3 102 | ``` 103 | 104 | Seznami lahko do petkrat gnezdite tako, da dodate dodatne zvezdice ali pike. 105 | 106 | ``` 107 | * foo 1 108 | ** foo 2 109 | *** foo 3 110 | **** foo 4 111 | ***** foo 5 112 | 113 | . foo 1 114 | .. foo 2 115 | ... foo 3 116 | .... foo 4 117 | ..... foo 5 118 | ``` 119 | 120 | ## Nadaljnje branje 121 | 122 | Obstajata dve orodji za obdelavo AsciiDoc dokumentov: 123 | 124 | 1. [AsciiDoc](http://asciidoc.org/): izvirna implementacija v Pythonu je na voljo v glavnih distribucijah Linuxa. Stabilen in trenutno v vzdrževalnem načinu. 125 | 2. [Asciidoctor](http://asciidoctor.org/): alternativna Ruby implementacija, uporabno tudi iz Java in JavaScript. Z aktivnim razvojem si prizadeva razširiti sintakso AsciiDoc z novimi funkcijami in izhodnimi formati. 126 | 127 | Naslednje povezave so povezane `Asciidoctor` implementacijo: 128 | 129 | * [Markdown - AsciiDoc syntax comparison](http://asciidoctor.org/docs/user-manual/#comparison-by-example): primerjava skupnih elementov Markdowna in AsciiDoca. 130 | * [Getting started](http://asciidoctor.org/docs/#get-started-with-asciidoctor): namestitev in navodila, ki omogočajo enostavne dokumente. 131 | * [Asciidoctor User Manual](http://asciidoctor.org/docs/user-manual/): popolni priročnik z enim dokumentom s sklicevanjem na sintakso, primeri in oridji za upodabljanje. 132 | -------------------------------------------------------------------------------- /sv/json.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Anna Harren", "https://github.com/iirelu"] 4 | - ["Marco Scannadinari", "https://github.com/marcoms"] 5 | - ["himanshu", "https://github.com/himanshu81494"] 6 | - ["Michael Neth", "https://github.com/infernocloud"] 7 | translators: 8 | - ["Lari Kovanen", "https://github.com/larkov"] 9 | - ["Joakim Lahtinen", "https://github.com/VibyJocke"] 10 | --- 11 | 12 | JSON är ett extremt enkelt datautbytesformat. Som [json.org](http://json.org) beskriver så är det lätt för människor att läsa och skriva, och för datorer att tolka och generera. 13 | 14 | En bit av JSON måste representera antingen: 15 | * En samling av namn/värde-par (`{ }`). I olika språk kan denna realiseras som ett objekt, struct, dictionary, hash-tabell, nyckellista eller en associativ array. 16 | * En ordnad lista av värden (`[ ]`). I olika språk kan denna realiseras som en array, vektor, lista eller sekvens. 17 | 18 | JSON i dess renaste form har inga kommentarer, men de flesta tolkarna accepterar C-stils (`//`, `/* */`) kommentarer. Vissa tolkar tolererar även komman efter sista elementet i en array, eller det sista attributet av ett objekt, men dessa bör undvikas för bättre kompabilitet. 19 | 20 | Detta dokument kommer dock att tillämpa 100% giltigt JSON. Lyckligtvis så är resten av dokumentet självförklarande. 21 | 22 | Följande datatyper stöds: 23 | * Strängar: `"hello"`, `"\"A quote.\""`, `"\u0abe"`, `"Newline.\n"` 24 | * Nummer: `23`, `0.11`, `12e10`, `3.141e-10`, `1.23e+4` 25 | * Objekt: `{ "key": "value" }` 26 | * Arrayer: `["Values"]` 27 | * Övriga: `true`, `false`, `null` 28 | 29 | ```json 30 | { 31 | "nyckel": "värde", 32 | 33 | "nycklar": "måste alltid omslutas med dubbla citationstecken", 34 | "nummer": 0, 35 | "strängar": "Alla unicode-tecken (inklusive \"escaping\") är tillåtna.", 36 | "boolska värden?": true, 37 | "nullvärden": null, 38 | 39 | "stora tal": 1.2e+100, 40 | 41 | "objekt": { 42 | "kommentar": "De flesta datastukturerna i JSON kommer i form av objekt.", 43 | 44 | "matris": [0, 1, 2, 3, "Matriser kan innehålla vad som helst.", 5], 45 | 46 | "ytterligare objekt": { 47 | "kommentar": "Objekten kan vara nästlade." 48 | } 49 | }, 50 | 51 | "trams": [ 52 | { 53 | "kaliumkällor": ["bananer"] 54 | }, 55 | [ 56 | [1, 0, 0, 0], 57 | [0, 1, 0, 0], 58 | [0, 0, 1, "neo"], 59 | [0, 0, 0, 1] 60 | ] 61 | ], 62 | 63 | "alternativ formatering": { 64 | "kommentar": "kolla på detta!" 65 | , "kommats position": "spelar ingen roll - så länge det kommer innan värdet" 66 | , "en kommentar till": "vad fint" 67 | }, 68 | 69 | 70 | 71 | "blanksteg": "Spelar ingen roll.", 72 | 73 | 74 | 75 | "det var kort": "Nu är du klar och kan allt vad JSON har att erbjuda." 76 | } 77 | ``` 78 | 79 | ## Fortsatt läsning 80 | 81 | * [JSON.org](http://json.org/json-sv.html) Allt du kan tänkas vilja veta om JSON, och lite därtill. 82 | -------------------------------------------------------------------------------- /ta/json.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Anna Harren", "https://github.com/iirelu"] 4 | - ["Marco Scannadinari", "https://github.com/marcoms"] 5 | - ["himanshu", "https://github.com/himanshu81494"] 6 | translators: 7 | - ["Rasendran Kirushan", "https://github.com/kirushanr"] 8 | --- 9 | 10 | ஜேசன் ஒரு ஒரு மிக எளிய தரவு உள்மாற்றீட்டு வடிவம் ஆகும். 11 | Learn X in Y Minutes இதுவே மிகவும் இலகுவான பகுதியாக அமைய போகிறது. 12 | 13 | 14 | ஜேசன் இன் எளிமையான கட்டமைப்பில் குறிப்புக்கள் (Comments) இல்லை , எனினும் 15 | பெரும்பாலான பாகுபடுத்திகளில் C - style முறையிலான (`//`, `/* */`) குறிப்புகளை இட முடியும். 16 | சில பாகுபடுத்திகள்(interpreter) குறிப்புகளுக்கு (comments)தொடர்ச்சியாக வரும் 17 | காற்புள்ளியை அனுமதிக்கின்றன (உதாரணமாக ஒரு அணியை (array) அடுத்துவரும் காற்புள்ளி 18 | அல்லது ஒரு பொருளில் (object)உள்ள கடைசி உறுப்பை/சொத்தை( last property) அடுத்து வரும் காற்புள்ளி ) 19 | எனினும் சகல இடங்களிலும் ஜேசன் பயன்படுத்த பட வேண்டும் எனில் மேற்கூறிய குறிப்புகளை தவிர்த்தல் நல்லது .\ 20 | 21 | 22 | ஜேசன் 100% மிக சரியாக அமைவது மட்டும் இன்றி 23 | இலகுவாக புரியக் கூடிய எளிய தரவு உள்மாற்றீட்டு வடிவம் ஆகும். 24 | 25 | 26 | ஜேசன் அனுமதிக்கும் தரவு வகைகள் : சரம் (string),முழு (int),பூலியன் (தர்க ரீதியில் ஆன கட்டமைப்பு), 27 | அணி (array ),கழி (null ),பொருள் (object). 28 | 29 | ஜேசன் அனுமதிக்கும் அல்லது பாவனைக்கு உட்படுத்த கூடிய உலாவிகள் (browsers): 30 | Firefox(Mozilla) 3.5, Internet Explorer 8, Chrome, Opera 10, Safari 4. 31 | 32 | ஜேசனின் கோப்புவகை(filetype) ".json " ஆகும் . 33 | 34 | ஜேசன் உரைக்கான MIME வகை "application/json" ஆகும். 35 | ஜேசன் இல் காணப்படும் பிரதான பின்னடைவு தரவு இனம் இதுவென்று வரையறுக்க 36 | படாமை ஆகும் . 37 | 38 | ஒரு ஜேசன் இன் எளிய கட்டமைப்பு கீழே காட்டப்பட்டுள்ளது 39 | 40 | ```json 41 | { 42 | "key": "ஒரு சாவிக்கு ஒரு பெறுமதி உள்ளது ", 43 | 44 | "keys": "சாவிகள் , மற்றும் பெறுமானங்கள் மேற்கோள் குறிக்குள் இடல் வேண்டும்", 45 | "numbers": 0, 46 | "strings": "Hellø, wørld. எல்லாவகையான unicode உம் அனுமதிக்கப்படும், அத்துடன் \"escaping\".", 47 | "has bools?": true, 48 | "nothingness": null, 49 | 50 | "big number": 1.2e+100, 51 | 52 | "objects": { 53 | "comment": "பெரும்பாலான கட்டமைப்புகள் objects இல் இருந்தே வருகின்றன", 54 | 55 | "array": [0, 1, 2, 3, "array யானது எல்லாவகையான பெறுமானங்களையும் கொண்டிருக்கும்", 5], 56 | 57 | "another object": { 58 | "comment": "இவை ஒன்றுக்குள் இன்னொன்றை எழுத முடியும்" 59 | } 60 | }, 61 | 62 | "silliness": [ 63 | { 64 | "sources of potassium": ["வாழைபழம்"] 65 | }, 66 | [ 67 | [1, 0, 0, 0], 68 | [0, 1, 0, 0], 69 | [0, 0, 1, "neo"], 70 | [0, 0, 0, 1] 71 | ] 72 | ], 73 | 74 | "alternative style": { 75 | "comment": "இதை பார்க்கவும்" 76 | , "comma position": "doesn't matter - as long as it's before the value, then it's valid" 77 | , "another comment": "how nice" 78 | }, 79 | 80 | "that was short": "நீங்கள் ஜேசன் பற்றி யாவற்றையும் கற்றுள்ளீர்கள்" 81 | } 82 | ``` 83 | 84 | -------------------------------------------------------------------------------- /tr/dynamic-programming.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Akashdeep Goel", "https://github.com/akashdeepgoel"] 4 | translators: 5 | - ["Mehmet Cem Yaraş", "https://www.linkedin.com/in/yarascem/"] 6 | --- 7 | 8 | # Dinamik Programlama 9 | 10 | ## Giriş 11 | 12 | Dinamik Programlama, göreceğimiz gibi belirli bir problem sınıfını çözmek için kullanılan güçlü bir tekniktir. Fikir çok basittir, verilen girdiyle ilgili bir sorunu çözdüyseniz, aynı sorunun tekrar çözülmesini önlemek için sonucunu gelecekte referans olarak kaydedilmesine dayanır. 13 | 14 | Her zaman hatırla! "Geçmiş hatırlayamayanlar, aynı şeyleri tekrar yaşamaya mahkumlardır!" 15 | 16 | ## Bu tür sorunların çözüm yolları 17 | 18 | 1. Yukarıdan aşağıya: Verilen problemi çözerek çözmeye başlayın. Sorunun zaten çözüldüğünü görürseniz, kaydedilen cevabı döndürmeniz yeterlidir. Çözülmemişse, çözünüz ve cevabı saklayınız. Bu genellikle düşünmek kolaydır ve çok sezgiseldir. Buna Ezberleştirme denir. 19 | 2. Aşağıdan yukarıya: Sorunu analiz edin ve alt problemlerin çözülme sırasını görün ve önemsiz alt sorundan verilen soruna doğru başlayın. Bu süreçte, problemi çözmeden önce alt problemlerin çözülmesi gerekmektedir. Buna Dinamik Programlama denir. 20 | 21 | ## Örnek 22 | 23 | En Uzun Artan Subsequence problemi belirli bir dizinin en uzun artan alt dizini bulmaktır. `S = {a1, a2, a3, a4, ............., an-1}` dizisi göz önüne alındığında, en uzun bir alt kümeyi bulmak zorundayız, böylece tüm j ve i, `j a[j] and LS[i] 28 | 29 | 文档开始。 30 | ``` 31 | 32 | 多名作者的情形 33 | 34 | ``` 35 | = 文档标题 36 | 李四 ; 王五 ; 赵六 37 | 38 | 有多名作者的文档开始。 39 | ``` 40 | 41 | 版本行(需要作者行) 42 | 43 | ``` 44 | = 文档标题(第一版) 45 | 土豆人 46 | v1.0, 2016-01-13 47 | 48 | 这篇关于炸薯条的文章会很有趣。 49 | ``` 50 | 51 | 段落 52 | 53 | ``` 54 | 段落不需要什么特别操作。 55 | 56 | 在两段之间用一个空行隔开。 57 | 58 | 当你需要换行时,添加一个 + 59 | 你就会得到一个换行符! 60 | ``` 61 | 62 | 文本格式化 63 | 64 | ``` 65 | _用下划线创建斜体_ 66 | *用星号加粗* 67 | *_组合起来用更有趣_* 68 | `用重音符显示等宽字体` 69 | `*加粗等宽字体*` 70 | ``` 71 | 72 | 节标题 73 | 74 | ``` 75 | = 第 0 级 (一般只用于文档标题) 76 | 77 | == 第 1 级

78 | 79 | === 第 2 级

80 | 81 | ==== 第 3 级

82 | 83 | ===== 第 4 级

84 | ``` 85 | 86 | 列表 87 | 88 | 用星号创建无序列表。 89 | 90 | ``` 91 | * 甲 92 | * 乙 93 | * 丙 94 | ``` 95 | 96 | 用句点创建有序列表。 97 | 98 | ``` 99 | . 项目 1 100 | . 项目 2 101 | . 项目 3 102 | ``` 103 | 104 | 你可以用额外的星号或句点来嵌套最多五次列表。 105 | 106 | ``` 107 | * 甲 1 108 | ** 甲 2 109 | *** 甲 3 110 | **** 甲 4 111 | ***** 甲 5 112 | 113 | . 甲 1 114 | .. 甲 2 115 | ... 甲 3 116 | .... 甲 4 117 | ..... 甲 5 118 | ``` 119 | 120 | ## 补充材料 121 | 122 | 处理 AsciiDoc 文档有两种工具: 123 | 124 | 1. [AsciiDoc](http://asciidoc.org/): 原版的 Python 实现,在主流 Linux 发行版中已附带,目前处于稳定版本维护模式。 125 | 2. [Asciidoctor](http://asciidoctor.org/): 使用 Ruby 的另一种实现,也可以从 Java 和 JavaScript 中使用。它处于积极的开发中,目标是用新特性和输出格式扩展 AsciiDoc 的语法。 126 | 127 | 以下是 `Asciidoctor` 实现的相关链接: 128 | 129 | * [Markdown - AsciiDoc 语法比较](http://asciidoctor.org/docs/user-manual/#comparison-by-example):并列比较一般 Markdown 和 AsciiDoc 的元素。 130 | * [入门](http://asciidoctor.org/docs/#get-started-with-asciidoctor):安装和快速启动指南,帮助构建简单的文档。 131 | * [Asciidoctor 用户手册](http://asciidoctor.org/docs/user-manual/): 完整的单文档指南,包含语法参考、示例、渲染工具等。 132 | -------------------------------------------------------------------------------- /zh-cn/bc.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Btup"] 4 | translators: 5 | - ["CloneWith", "https://github.com/CloneWith"] 6 | --- 7 | ```bc 8 | /*这是一条 9 | 多行注释。*/ 10 | # 这(在 GNU bc 中)也是一条(单行)注释! 11 | 12 | /*1. 变量与指令结构*/ 13 | num = 45 /*所有变量都只以双精度浮点数形式存储, 14 | 并且 bc 不支持直接存储字符串常量。*/ 15 | num = 45; /*每个语句后可以添加 16 | 一个英文分号,也可以不加。*/ 17 | /*语句块使用 {} 运算符表示(与 C 语言相似):*/ 18 | while(num < 50) { 19 | num += 1 /*等价于 num=num+1。 20 | a = a op b 等价于 a op= b。*/ 21 | } 22 | /*也有 ++(自加)与 --(自减)运算符。*/ 23 | /*有三个特殊变量: 24 | scale: 定义双精度浮点数字的比例。 25 | ibase: 定义输入数值的基数。 26 | obase: 定义输出数值的基数。*/ 27 | /*If 语句:*/ 28 | hour = read() /*输入一个数字*/ 29 | 30 | if(hour < 12) { /*运算符的用法与 C 语言类似。*/ 31 | print "Good morning\n" /*“print”输出字符串或变量,用英文逗号分隔。*/ 32 | } else if(hour == 12) { 33 | print "Hello\n" 34 | /*字符串中的转义序列以反斜杠 \ 开头。 35 | 为了讲述清楚,以下为 bc 中常用转义序列表: 36 | \b: 退格 37 | \c: 硬回车 38 | \n: 换行符 39 | \t: 制表符 40 | \\: 反斜杠*/ 41 | } else { 42 | print "Good afternoon\n" 43 | } 44 | 45 | /*像 C 语言一样,只有 0 定义为假(false)。*/ 46 | num = 0 47 | if(!num) {print "false\n"} 48 | 49 | /*与 C 语言不同,bc 没有 ?: 运算符。例如, 50 | 这个代码块会导致出错: 51 | a = (num) ? 1 : 0 52 | 但是你可以模拟一个:*/ 53 | a = (num) && (1) || (0) /*&& 代表“与”,|| 代表“或”*/ 54 | 55 | /*循环语句*/ 56 | num = 0 57 | for(i = 1; i <= 100; i++) {/*与 C 语言中的循环类似。*/ 58 | num += i 59 | } 60 | 61 | /*2.函数与数组*/ 62 | define fac(n) { /*使用“define”定义函数。*/ 63 | if(n == 1 || n == 0) { 64 | return 1 /*返回一个数值*/ 65 | } 66 | return n * fac(n - 1) /*可以使用递归*/ 67 | } 68 | 69 | /*不可使用闭包与匿名函数。*/ 70 | 71 | num = fac(4) /*24*/ 72 | 73 | /*这是局部变量的示例:*/ 74 | define x(n) { 75 | auto x 76 | x = 1 77 | return n + x 78 | } 79 | x(3) /*4*/ 80 | print x /*看起来无法在函数外访问 x。*/ 81 | /*数组与 C 语言中的等同。*/ 82 | for(i = 0; i <= 3; i++) { 83 | a[i] = 1 84 | } 85 | /*这样访问它:*/ 86 | print a[0], " ", a[1], " ", a[2], " ", a[3], "\n" 87 | quit /*添加这行代码,确保程序退出。 88 | 这行代码可写可不写。*/ 89 | ``` 90 | 91 | 请享用这个简单的计算器吧!(或者确切地讲,这个编程语言。) 92 | 93 | 本程序全部使用 GNU bc 语言编写。要运行程序,请使用 ```bc learnbc.bc```。 94 | -------------------------------------------------------------------------------- /zh-cn/bf.md: -------------------------------------------------------------------------------- 1 | --- 2 | filename: brainfuck.bf 3 | contributors: 4 | - ["Prajit Ramachandran", "http://prajitr.github.io/"] 5 | - ["Mathias Bynens", "http://mathiasbynens.be/"] 6 | translators: 7 | - ["lyuehh", "https://github.com/lyuehh"] 8 | 9 | --- 10 | 11 | Brainfuck 是一个极小的只有8个指令的图灵完全的编程语言。 12 | 13 | ```bf 14 | 除"><+-.,[]"之外的的任何字符都会被忽略 (不包含双引号)。 15 | 16 | Brainfuck 包含一个有30,000个单元为0的数组,和 17 | 一个数据指针指向当前的单元。 18 | 19 | 8个指令如下: 20 | + : 指针指向的单元的值加1 21 | - : 指针指向的单元的值减1 22 | > : 将指针移动到下一个单元(右边的元素) 23 | < : 将指针移动到上一个单元(左边的元素) 24 | . : 打印当前单元的内容的ASCII值 (比如 65 = 'A'). 25 | , : 读取一个字符到当前的单元 26 | [ : 如果当前单元的值是0,则向后调转到对应的]处 27 | ] : 如果当前单元的值不是0,则向前跳转到对应的[处 28 | 29 | [ 和 ] 组成了一个while循环。很明显,它们必须配对。 30 | 31 | 让我们看一些基本的brainfuck 程序。 32 | 33 | ++++++ [ > ++++++++++ < - ] > +++++ . 34 | 35 | 这个程序打印字母'A'。首先,它把 #1 增加到6,使用它来作为循环条件, 36 | 然后,进入循环,将指针移动到 #2 ,将 #2 的值增加到10,然后 37 | 移动回 #1,将单元 #1 的值减1,然后继续。循环共进行了6次。 38 | 39 | 这时,我们在 #1,它的值为0,#2 的值为60,我们移动到 40 | #2,将 #2 的内容加上5,然后将 #2 的内容打印出来,65在 41 | ASCII中表示'A', 所以'A'就会被打印出来。 42 | 43 | 44 | , [ > + < - ] > . 45 | 46 | 这个程序从用户的输入中读取一个字符,然后把它复制到 #1。 47 | 然后我们开始一个循环,移动到 #2,将 #2 的值加1,再移动回 #1,将 #1 48 | 的值减1,直到 #1的值为0,这样 #2 里就保存了 #1 的旧值,循环结束时我们 49 | 在 #1,这时我们移动到 #2,然后把字符以ASCII打印出来。 50 | 51 | 而且要记住的一点就是,空格在这里只是为了可读性,你可以将他们写成这样: 52 | 53 | ,[>+<-]>. 54 | 55 | 试着思考一下这段程序是干什么的: 56 | 57 | ,>,< [ > [ >+ >+ << -] >> [- << + >>] <<< -] >> 58 | 59 | 这段程序从输入接收2个参数,然后将他们相乘。 60 | 61 | 先读取2个输入,然后开始外层循环,以 #1 作为终止条件,然后将指针移动到 62 | #2,然后开始 #2 的内层循环,将 #3 加1。但是这里有一个小问题,在内层 63 | 循环结束的时候,#2 的值是0了,那么下次执行外层循环的时候,就有问题了。 64 | 为了解决这个问题,我们可以增加 #4 的值,然后把 #4 的值复制到 #2, 65 | 最后结果就保存在 #3 中了。 66 | ``` 67 | 68 | 好了这就是brainfuck了。也没那么难,是吧?为了好玩,你可以写你自己的 69 | brainfuck程序,或者用其他语言写一个brainfuck的解释器,解释器非常容易 70 | 实现,但是如果你是一个自虐狂的话,你可以尝试用brainfuck写一个brainfuk的 71 | 解释器。 72 | -------------------------------------------------------------------------------- /zh-cn/coffeescript.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Tenor Biel", "http://github.com/L8D"] 4 | - ["Xavier Yao", "http://github.com/xavieryao"] 5 | translators: 6 | - ["Xavier Yao", "http://github.com/xavieryao"] 7 | --- 8 | 9 | CoffeeScript是逐句编译为JavaScript的一种小型语言,且没有运行时的解释器。 10 | 作为JavaScript的替代品之一,CoffeeScript旨在编译人类可读、美观优雅且速度不输原生的代码, 11 | 且编译后的代码可以在任何JavaScript运行时正确运行。 12 | 13 | 参阅 [CoffeeScript官方网站](http://coffeescript.org/)以获取CoffeeScript的完整教程。 14 | 15 | ``` coffeescript 16 | # CoffeeScript是一种很潮的编程语言, 17 | # 它紧随众多现代编程语言的趋势。 18 | # 因此正如Ruby和Python,CoffeeScript使用井号标记注释。 19 | 20 | ### 21 | 大段落注释以此为例,可以被直接编译为 '/ *' 和 '* /' 包裹的JavaScript代码。 22 | 23 | 在继续之前你需要了解JavaScript的基本概念。 24 | 25 | 示例中 => 后为编译后的JavaScript代码 26 | ### 27 | 28 | # 赋值: 29 | number = 42 #=> var number = 42; 30 | opposite = true #=> var opposite = true; 31 | 32 | # 条件: 33 | number = -42 if opposite #=> if(opposite) { number = -42; } 34 | 35 | # 函数: 36 | square = (x) -> x * x #=> var square = function(x) { return x * x; } 37 | 38 | fill = (container, liquid = "coffee") -> 39 | "Filling the #{container} with #{liquid}..." 40 | #=>var fill; 41 | # 42 | #fill = function(container, liquid) { 43 | # if (liquid == null) { 44 | # liquid = "coffee"; 45 | # } 46 | # return "Filling the " + container + " with " + liquid + "..."; 47 | #}; 48 | 49 | # 区间: 50 | list = [1..5] #=> var list = [1, 2, 3, 4, 5]; 51 | 52 | # 对象: 53 | math = 54 | root: Math.sqrt 55 | square: square 56 | cube: (x) -> x * square x 57 | #=> var math = { 58 | # "root": Math.sqrt, 59 | # "square": square, 60 | # "cube": function(x) { return x * square(x); } 61 | #} 62 | 63 | # Splats: 64 | race = (winner, runners...) -> 65 | print winner, runners 66 | #=>race = function() { 67 | # var runners, winner; 68 | # winner = arguments[0], runners = 2 <= arguments.length ? __slice.call(arguments, 1) : []; 69 | # return print(winner, runners); 70 | #}; 71 | 72 | # 存在判断: 73 | alert "I knew it!" if elvis? 74 | #=> if(typeof elvis !== "undefined" && elvis !== null) { alert("I knew it!"); } 75 | 76 | # 数组推导: 77 | cubes = (math.cube num for num in list) 78 | #=>cubes = (function() { 79 | # var _i, _len, _results; 80 | # _results = []; 81 | # for (_i = 0, _len = list.length; _i < _len; _i++) { 82 | # num = list[_i]; 83 | # _results.push(math.cube(num)); 84 | # } 85 | # return _results; 86 | # })(); 87 | 88 | foods = ['broccoli', 'spinach', 'chocolate'] 89 | eat food for food in foods when food isnt 'chocolate' 90 | #=>foods = ['broccoli', 'spinach', 'chocolate']; 91 | # 92 | #for (_k = 0, _len2 = foods.length; _k < _len2; _k++) { 93 | # food = foods[_k]; 94 | # if (food !== 'chocolate') { 95 | # eat(food); 96 | # } 97 | #} 98 | ``` 99 | -------------------------------------------------------------------------------- /zh-cn/dynamic-programming.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Akashdeep Goel", "http://github.com/akashdeepgoel"] 4 | translators: 5 | - ["EtaoinWu", "https://github.com/EtaoinWu"] 6 | --- 7 | 8 | # 动态规划 9 | 10 | ## 简介 11 | 12 | 动态规划是一种实用的技巧,它可以用来解决一系列特定问题。它的思路很简单,如果你对某个给定的输入解决了一个问题,那么你可以保存已有信息,以避免重复计算,节约计算时间。 13 | 14 | 记住,如果忘记历史,就要被迫做更多的苦力。斐波那契数列就是一个显然的例子。 15 | 16 | ## 解决问题的方式 17 | 18 | 1. *自顶向下* : 利用分支策略分解问题。如果你已经解决过当前子问题了,那么就返回已有信息。如果当前子问题没有计算过,那么就对它进行计算。这样的方法很易于思考、很直观。这被称作“记忆化”。 19 | 20 | 2. *自底向上* : 首先分析问题,将问题分解为不同规模的问题,并决定它们的顺序,按顺序计算,直到解决给定规模的问题。这样的流程可以保证在解决较大的问题之前解决(它所依赖的)较小的问题。这种流程被称作“动态规划”。 21 | 22 | ## 动态规划的例子 23 | 24 | 最长上升子序列问题。给定`S= {a[1] , a[2] , a[3], a[4], ............., a[n-1], a[n] }`,求出一个子序列,使得对于所有在这个子序列中所有满足`j a[j] and dp[i] 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 我的网站 31 | 32 | 33 |

Hello, world!

34 | 来看看这里有什么 35 |

这是一个段落。

36 |

这是另外一个段落。

37 |
    38 |
  • 这是一个非计数列表的一项(项目符合列表)
  • 39 |
  • 这是另一项
  • 40 |
  • 这是列表中的最后一项
  • 41 |
42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 我的网站 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |

Hello, world!

71 | 72 | 来看看这里有什么 73 |

这是一个段落。

74 |

这是另外一个段落。

75 |
    76 | 77 |
  • 这是一个非计数列表的一项(项目符合列表)
  • 78 |
  • 这是另一项
  • 79 |
  • 这是列表中的最后一项
  • 80 |
81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 |
第一个表头 第二个表头
第一行第一列 第一行第二列
第二行第一列第二行第二列
107 | ``` 108 | 109 | ## 使用 110 | 111 | HTML文件使用`.html`后缀。 112 | 113 | ## 扩展阅读 114 | 115 | * [维基百科](https://en.wikipedia.org/wiki/HTML) 116 | * [HTML tutorial](https://developer.mozilla.org/en-US/docs/Web/HTML) 117 | * [W3School](http://www.w3schools.com/html/html_intro.asp) 118 | -------------------------------------------------------------------------------- /zh-cn/jquery.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Sawyer Charles", "https://github.com/xssc"] 4 | translators: 5 | - ["zxyqwe", "https://github.com/zxyqwe"] 6 | --- 7 | 8 | jQuery是JavaScript的一个函数库,它可以帮你“写更少,做更多”。它集成了很多常见的JavaScript任务并且很容易调用。jQuery被世界各地的很多的大公司和开发者使用。它包括了AJAX,事件处理,文档操作以及很多其它功能,并且更加简单和快速。 9 | 10 | 正因为jQuery是JavaScript的一个函数库,所以你需要[首先学习JavaScript](../javascript/) 11 | 12 | ```js 13 | /////////////////////////////////// 14 | // 1. 选择器 15 | 16 | // jQuery中的选择器被用来选择一个元素 17 | var page = $(window); // 选择整个视窗 18 | 19 | // 选择器可以作为CSS选择器使用 20 | var paragraph = $('p'); // 选择所有段落元素 21 | var table1 = $('#table1'); // 选择id为table1的元素 22 | var squares = $('.square'); // 选择所有类是square的元素 23 | var square_p = $('p.square') // 选择具有square类的所有段落 24 | 25 | 26 | /////////////////////////////////// 27 | // 2. 事件和效果 28 | // jQuery非常善于处理当事件触发的时候应该做什么 29 | // 一个非常常见的事件就是文档的就绪事件 30 | // 你可以用ready方法,在所有元素完成加载的时候执行 31 | $(document).ready(function(){ 32 | // 只有文档加载完成以后代码才会执行 33 | }); 34 | // 你也可以用定义了的函数 35 | function onAction() { 36 | // 本函数在事件触发的时候被执行 37 | } 38 | $('#btn').click(onAction); // 当点击的时候调用onAction函数 39 | 40 | // 其它常见的事件: 41 | $('#btn').dblclick(onAction); // 双击 42 | $('#btn').hover(onAction); // 划过 43 | $('#btn').focus(onAction); // 聚焦 44 | $('#btn').blur(onAction); // 失焦 45 | $('#btn').submit(onAction); // 提交 46 | $('#btn').select(onAction); // 当元素被选中 47 | $('#btn').keydown(onAction); // 当一个按键被按下 48 | $('#btn').keyup(onAction); // 当一个按键被抬起 49 | $('#btn').keypress(onAction); // 当一个按键被按住 50 | $('#btn').mousemove(onAction); // 当鼠标在移动 51 | $('#btn').mouseenter(onAction); // 鼠标移入元素 52 | $('#btn').mouseleave(onAction); // 鼠标离开元素 53 | 54 | 55 | // 如果不提供任何参数的话,那么这些方法可以触发事件 56 | // 而不是定义处理事件的方法 57 | $('#btn').dblclick(); // 触发元素上的双击 58 | 59 | // 你可以只用选择器一次而处理多个事件 60 | $('#btn').on( 61 | {dblclick: myFunction1} // 双击的时候触发 62 | {blur: myFunction1} // 失焦的时候触发 63 | ); 64 | 65 | // 你可以用一些效果函数来移动或隐藏元素 66 | $('.table').hide(); // 隐藏元素 67 | 68 | // 注意:在这些方法中调用函数会仍然隐藏元素 69 | $('.table').hide(function(){ 70 | // 元素先隐藏然后函数被执行 71 | }); 72 | 73 | // 你可以在变量中储存选择器 74 | var tables = $('.table'); 75 | 76 | // 一些基本的文档操作方法有: 77 | tables.hide(); // 隐藏元素 78 | tables.show(); // 显示元素 79 | tables.toggle(); // 对被选元素进行隐藏和显示的切换 80 | tables.fadeOut(); // 淡出 81 | tables.fadeIn(); // 淡入 82 | tables.fadeToggle(); // 对被选元素进行淡入和淡出显示的切换 83 | tables.fadeTo(0.5); // 把被选元素逐渐改变至给定的不透明度(0和1之间) 84 | tables.slideUp(); // 通过调整高度来滑动隐藏被选元素 85 | tables.slideDown(); // 对被选元素进行滑动隐藏和滑动显示的切换 86 | tables.slideToggle(); // 对被选元素进行滑动隐藏和滑动显示的切换 87 | 88 | // 上面所有的方法接受速度参数(毫秒)和一个回调函数 89 | tables.hide(1000, myFunction); // 持续一秒的隐藏动画然后执行函数 90 | 91 | // fadeTo要求提供透明度参数作为第二个参数 92 | tables.fadeTo(2000, 0.1, myFunction); // 通过2秒钟将透明度变为0.1然后执行函数 93 | 94 | // 你可以用animate方法实现一些略微高级的效果 95 | tables.animate({margin-top:"+=50", height: "100px"}, 500, myFunction); 96 | // animate方法接受一个包含CSS和值的对象作为目标, 97 | // 其次是可选的速度参数, 98 | // 以及最后的回调函数 99 | 100 | /////////////////////////////////// 101 | // 3. 操作 102 | 103 | // 这些类似效果函数但是可以做更多 104 | $('div').addClass('taming-slim-20'); // 给所有div添加类taming-slim-20 105 | 106 | // 常见操作方法 107 | $('p').append('Hello world'); // 添加到元素末尾 108 | $('p').attr('class'); // 获取属性 109 | $('p').attr('class', 'content'); // 设置属性 110 | $('p').hasClass('taming-slim-20'); // 如果有类则为真 111 | $('p').height(); // 获取和设置元素的高度 112 | 113 | 114 | // 对于很多的操作函数来说,获取元素的信息 115 | // 仅仅是第一个符合元素的 116 | $('p').height(); // 仅仅获取第一个p标签的高度 117 | 118 | // 你可以用each来迭代所有元素 119 | var heights = []; 120 | $('p').each(function() { 121 | heights.push($(this).height()); // 把所有p标签的高度加入数组 122 | }); 123 | ``` 124 | -------------------------------------------------------------------------------- /zh-cn/json.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Anna Harren", "https://github.com/iirelu"] 4 | translators: 5 | - ["Zach Zhang", "https://github.com/checkcheckzz"] 6 | --- 7 | 8 | JSON是一个极其简单的数据交换格式。按[json.org](https://json.org)说的,它对人类易读易写,对机器易解析易生成。 9 | 10 | 一段JSON可以是下文列出的类型的任意值,但实际一般按以下两种方式之一呈现: 11 | 12 | * 一个键值对的集合(`{ }`)。按不同语言,这可能被理解为对象/记录/结构体/字典/哈希表/有键列表/关联数组 13 | * 一个有序的值列表(`[ ]`)。按不同语言,这可能被理解为数组/向量/列表/序列 14 | 15 | 纯正的JSON实际上没有注释,但是大多数解析器都接受C-风格(//, /\* \*/)的注释。一些解析器还容许trailing comma,即最后一个数组元素或最后一个对象属性之后的逗号。不过为了兼容性最好避免。 16 | 17 | 因此,本教程的一切都会是100%有效的JSON。幸亏,它的表达能力很丰富。 18 | 19 | 支持的数据类型: 20 | 21 | * 字符串:`"hello"`、`"\"A quote.\""`、`"\u0abe"`、`"Newline.\n"` 22 | * 数字:`23`、`0.11`、`12e10`、`3.141e-10`、`1.23e+4` 23 | * 对象:`{ "key": "value" }` 24 | * 数组:`["Values"]` 25 | * 其它:`true`、`false`、`null` 26 | 27 | ```json 28 | { 29 | "key": "value", 30 | 31 | "keys": "must always be enclosed in double quotes", 32 | "numbers": 0, 33 | "strings": "Hellø, wørld. All unicode is allowed, along with \"escaping\".", 34 | "has bools?": true, 35 | "nothingness": null, 36 | 37 | "big number": 1.2e+100, 38 | 39 | "objects": { 40 | "comment": "Most of your structure will come from objects.", 41 | 42 | "array": [0, 1, 2, 3, "Arrays can have anything in them.", 5], 43 | 44 | "another object": { 45 | "comment": "These things can be nested, very useful." 46 | } 47 | }, 48 | 49 | "silliness": [ 50 | { 51 | "sources of potassium": ["bananas"] 52 | }, 53 | [ 54 | [1, 0, 0, 0], 55 | [0, 1, 0, 0], 56 | [0, 0, 1, "neo"], 57 | [0, 0, 0, 1] 58 | ] 59 | ], 60 | 61 | "alternative style": { 62 | "comment": "check this out!" 63 | , "comma position": "doesn't matter, if it's before the next key, it's valid" 64 | , "another comment": "how nice" 65 | }, 66 | 67 | 68 | 69 | "whitespace": "Does not matter.", 70 | 71 | 72 | 73 | "that was short": "And done. You now know everything JSON has to offer." 74 | } 75 | ``` 76 | 77 | ## 进一步阅读 78 | 79 | * [JSON.org](https://www.json.org/json-zh.html) 完美图解JSON的一切 80 | * [JSON Tutorial](https://www.youtube.com/watch?v=wI1CWzNtE-M) 简要介绍 81 | -------------------------------------------------------------------------------- /zh-cn/perl.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Korjavin Ivan", "http://github.com/korjavin"] 4 | translators: 5 | - ["Yadong Wen", "https://github.com/yadongwen"] 6 | --- 7 | 8 | Perl 是一个功能强大、特性齐全的编程语言,有25年的历史。 9 | 10 | Perl 可以在包括便携式设备和大型机的超过100个平台上运行,既适用于快速原型构建,也适用于大型项目开发。 11 | 12 | ```perl 13 | # 单行注释以#号开头 14 | 15 | 16 | #### Perl的变量类型 17 | 18 | # 变量以$号开头。 19 | # 合法变量名以英文字母或者下划线起始, 20 | # 后接任意数目的字母、数字或下划线。 21 | 22 | ### Perl有三种主要的变量类型:标量、数组和哈希。 23 | 24 | ## 标量 25 | # 标量类型代表单个值: 26 | my $animal = "camel"; 27 | my $answer = 42; 28 | 29 | # 标量类型值可以是字符串、整型或浮点类型,Perl会根据需要自动进行类型转换。 30 | 31 | ## 数组 32 | # 数组类型代表一列值: 33 | my @animals = ("camel", "llama", "owl"); 34 | my @numbers = (23, 42, 69); 35 | my @mixed = ("camel", 42, 1.23); 36 | 37 | 38 | 39 | ## 哈希 40 | # 哈希类型代表一个键/值对的集合: 41 | 42 | my %fruit_color = ("apple", "red", "banana", "yellow"); 43 | 44 | # 可以使用空格和“=>”操作符更清晰的定义哈希: 45 | 46 | my %fruit_color = ( 47 | apple => "red", 48 | banana => "yellow", 49 | ); 50 | # perldata中有标量、数组和哈希更详细的介绍。 (perldoc perldata). 51 | 52 | # 可以用引用构建更复杂的数据类型,比如嵌套的列表和哈希。 53 | 54 | #### 逻辑和循环结构 55 | 56 | # Perl有大多数常见的逻辑和循环控制结构 57 | 58 | if ( $var ) { 59 | ... 60 | } elsif ( $var eq 'bar' ) { 61 | ... 62 | } else { 63 | ... 64 | } 65 | 66 | unless ( condition ) { 67 | ... 68 | } 69 | # 上面这个比"if (!condition)"更可读。 70 | 71 | # 有Perl特色的后置逻辑结构 72 | print "Yow!" if $zippy; 73 | print "We have no bananas" unless $bananas; 74 | 75 | # while 76 | while ( condition ) { 77 | ... 78 | } 79 | 80 | 81 | # for和foreach 82 | for ($i = 0; $i <= $max; $i++) { 83 | ... 84 | } 85 | 86 | foreach (@array) { 87 | print "This element is $_\n"; 88 | } 89 | 90 | 91 | #### 正则表达式 92 | 93 | # Perl对正则表达式有深入广泛的支持,perlrequick和perlretut等文档有详细介绍。简单来说: 94 | 95 | # 简单匹配 96 | if (/foo/) { ... } # 如果 $_ 包含"foo"逻辑为真 97 | if ($a =~ /foo/) { ... } # 如果 $a 包含"foo"逻辑为真 98 | 99 | # 简单替换 100 | 101 | $a =~ s/foo/bar/; # 将$a中的foo替换为bar 102 | $a =~ s/foo/bar/g; # 将$a中所有的foo替换为bar 103 | 104 | 105 | #### 文件和输入输出 106 | 107 | # 可以使用“open()”函数打开文件用于输入输出。 108 | 109 | open(my $in, "<", "input.txt") or die "Can't open input.txt: $!"; 110 | open(my $out, ">", "output.txt") or die "Can't open output.txt: $!"; 111 | open(my $log, ">>", "my.log") or die "Can't open my.log: $!"; 112 | 113 | # 可以用"<>"操作符读取一个打开的文件句柄。 在标量语境下会读取一行, 114 | # 在列表环境下会将整个文件读入并将每一行赋给列表的一个元素: 115 | 116 | my $line = <$in>; 117 | my @lines = <$in>; 118 | 119 | #### 子程序 120 | 121 | # 写子程序很简单: 122 | 123 | sub logger { 124 | my $logmessage = shift; 125 | open my $logfile, ">>", "my.log" or die "Could not open my.log: $!"; 126 | print $logfile $logmessage; 127 | } 128 | 129 | # 现在可以像内置函数一样调用子程序: 130 | 131 | logger("We have a logger subroutine!"); 132 | ``` 133 | 134 | #### 使用Perl模块 135 | 136 | Perl模块提供一系列特性来帮助你避免重新发明轮子,[CPAN](http://www.cpan.org/)是下载模块的好地方。Perl发行版本身也包含很多流行的模块。 137 | 138 | perlfaq有很多常见问题和相应回答,也经常有对优秀CPAN模块的推荐介绍。 139 | 140 | #### 深入阅读 141 | 142 | - [perl-tutorial](http://perl-tutorial.org/) 143 | - [www.perl.com的learn站点](http://www.perl.org/learn.html) 144 | - [perldoc](http://perldoc.perl.org/) 145 | - 以及 perl 内置的: `perldoc perlintro` 146 | -------------------------------------------------------------------------------- /zh-cn/pyqt.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Nathan Hughes", "https://github.com/sirsharpest"] 4 | translators: 5 | - ["kdxcxs", "https://github.com/kdxcxs"] 6 | - ["lsvih", "https://github.com/lsvih"] 7 | - ["imlonghao", "https://github.com/imlonghao"] 8 | --- 9 | 10 | **Qt** 是一个用 C++ 实现的著名跨平台软件开发框架。只需少量更改有时候甚至不需要更改代码就能在多个软硬件平台上运行,同时拥有原生应用程序的功能和速度。 11 | 12 | 13 | 以下内容改编自 [Aleksey Kholovchuk](https://github.com/vortexxx192) 编写的 C++ 版 QT 简介,并用 pyqt 重构原文代码,实现了部分相同的功能。 14 | 15 | ```python 16 | import sys 17 | from PyQt4 import QtGui 18 | 19 | def window(): 20 | # 创建应用对象 21 | app = QtGui.QApplication(sys.argv) 22 | # 创建一个 widget,作为 label 的父控件 23 | w = QtGui.QWidget() 24 | # 在 widget 中添加一个 label 子控件 25 | b = QtGui.QLabel(w) 26 | # 设置 label 的文字 27 | b.setText("Hello World!") 28 | # 设置 widget 的尺寸和位置 29 | w.setGeometry(100, 100, 200, 50) 30 | b.move(50, 20) 31 | # 设置窗口的标题 32 | w.setWindowTitle("PyQt") 33 | # 显示 widget 及其所有子控件 34 | w.show() 35 | # 下面让程序跑起来,这行代码会启动事件循环并阻塞直到应用程序退出。 36 | sys.exit(app.exec_()) 37 | if __name__ == '__main__': 38 | window() 39 | ``` 40 | 41 | 为了运用 pyqt 中一些更高级的功能,我们需要开始学习使用其他控件。下文演示了如何弹出对话框,该对话框在用户确认操作或输入信息等情况下经常用到。 42 | 43 | ```python 44 | import sys 45 | from PyQt4.QtGui import * 46 | from PyQt4.QtCore import * 47 | def window(): 48 | app = QApplication(sys.argv) 49 | w = QWidget() 50 | # 创建一个按钮并添加到 widget 控件 w 51 | b = QPushButton(w) 52 | b.setText("Press me") 53 | b.move(50, 50) 54 | # 当按钮 b 被点击时调用 showdialog 函数 55 | # 注意函数调用时没有“()”,这样函数就能以对象的方式传入而非传入执行它所得到的返回值 56 | # 更多关于 pyqt 函数调用、传参等的内容见 pyqt 的信号机制 57 | b.clicked.connect(showdialog) 58 | w.setWindowTitle("PyQt Dialog") 59 | w.show() 60 | sys.exit(app.exec_()) 61 | 62 | # 对话框窗口创建函数 63 | # 当窗口中的按钮被点击时退出本程序 64 | def showdialog(): 65 | d = QDialog() 66 | b1 = QPushButton("ok", d) 67 | b1.move(50, 50) 68 | d.setWindowTitle("Dialog") 69 | # 这里的模态实现了在对话框弹出时阻塞程序同时屏蔽父窗口 70 | d.setWindowModality(Qt.ApplicationModal) 71 | # 当按钮被点击时整个进程将会结束 72 | b1.clicked.connect(sys.exit) 73 | d.exec_() 74 | if __name__ == '__main__': 75 | window() 76 | ``` 77 | -------------------------------------------------------------------------------- /zh-cn/set-theory.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Andrew Ryan Davis", "https://github.com/AndrewDavis1191"] 4 | translators: 5 | - ["Tianchen Xu", "https://github.com/lo0b0o"] 6 | --- 7 | 8 | 集合论是数学的一个分支,研究集合、它们的运算和它们的性质。 9 | 10 | * 集合由不重复的项组成。 11 | 12 | ## 基本符号 13 | 14 | ### 运算符 15 | 16 | * 并运算符,`∪`,表示“或”; 17 | * 交运算符,`∩`,表示“且”; 18 | * 差运算符,`\`,表示“不包括”; 19 | * 补运算符,`'`,表示补集; 20 | * 叉积运算符,`×`,表示笛卡尔积。 21 | 22 | ### 限定词 23 | 24 | * 冒号限定词,`:`,表示“使得”; 25 | * 从属限定词,`∈`,表示“属于”; 26 | * 子集限定词,`⊆`,表示“是……的子集”; 27 | * 真子集限定词,`⊂`,表示“是……的真子集”。 28 | 29 | ### 重要的集合 30 | 31 | * `∅`,空集,即不包含任何元素的集合; 32 | * `ℕ`,自然数集; 33 | * `ℤ`,整数集; 34 | * `ℚ`,有理数集; 35 | * `ℝ`,实数集。 36 | 37 | 关于以上集合,有如下几点需要注意: 38 | 39 | 1. 空集是其本身的子集(并且也是任何其他集合的子集),即便空集不包含任何项; 40 | 2. 数学家们对于零是否为自然数的看法通常并不统一,教科书一般会明确说明作者是否认为零是自然数。 41 | 42 | ### 基数 43 | 44 | 集合的基数,或者说大小,由该集合中的项目数量决定。基数运算符为 `|...|`。 45 | 46 | 例如,若 `S = { 1, 2, 4 }`,则 `|S| = 3`。 47 | 48 | ### 空集 49 | 50 | * 可以在集合符号中使用不成立的条件来构造空集,例如,`∅ = { x : x ≠ x }`,或 `∅ = { x : x ∈ N, x < 0 }`; 51 | * 空集总是唯一的(即,有且只有一个空集); 52 | * 空集是所有集合的子集; 53 | * 空集的基数为 0,即 `|∅| = 0`。 54 | 55 | ## 集合的表示 56 | 57 | ### 集合的逐项构造 58 | 59 | 集合可以通过包含其全部项的列表逐项生成。例如,`S = { a, b, c, d }`。 60 | 61 | 只要构成集合的项清楚,长列表可以用省略号缩短。例如,`E = { 2, 4, 6, 8, ... }` 显然为所有偶数构成的集合,它包含无穷多项,虽然我们只显式写出了其中四项。 62 | 63 | ### 集合构造器 64 | 65 | 集合构造器符号是构造集合的一种更具描述性的方式。它依赖于一个主语和一个谓词,使得 `S = { 主语 : 谓词 }`。 例如, 66 | 67 | ``` 68 | A = { x : x 是元音字母 } = { a, e, i, o, u, y} 69 | B = { x : x ∈ N, x < 10 } = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } 70 | C = { x : x = 2k, k ∈ N } = { 0, 2, 4, 6, 8, ... } 71 | ``` 72 | 73 | 有时,谓词可能会 "漏 "到主语中,例如, 74 | 75 | ``` 76 | D = { 2x : x ∈ N } = { 0, 2, 4, 6, 8, ... } 77 | ``` 78 | 79 | ## 关系 80 | 81 | ### 从属关系 82 | 83 | * 如果值 `a` 包含在集合 `A` 中,那么我们说 `a` 属于 `A`,并用符号表示为 `a ∈ A`。 84 | * 如果值 `a` 不包含于集合 `A` 中,那么我们说 `a` 不属于 `A`,并用符号表示为 `a ∉ A`。 85 | 86 | ### 相等关系 87 | 88 | * 如果两个集合包括相同的项,那么我们说这两个集合相等,例如,`A = B`。 89 | * 集合的相等关系于顺序无关,例如 `{ 1, 2, 3, 4 } = { 2, 3, 1, 4 }`。 90 | * 集合中的元素不能重复,例如 `{ 1, 2, 2, 3, 4, 3, 4, 2 } = { 1, 2, 3, 4 }`。 91 | * 集合 `A` 与 `B` 相等当且仅当 `A ⊆ B` 且 `B ⊆ A`。 92 | 93 | ## 特殊集合 94 | 95 | ### 幂集 96 | 97 | * 令 `A` 为任意集合。幂集指的是包括了 `A` 的所有子集的集合,记作 `P(A)`。如果集合 `A` 由 `2n` 个元素组成,那么 `P(A)` 中有 `2^n` 个元素。 98 | 99 | ``` 100 | P(A) = { x : x ⊆ A } 101 | ``` 102 | 103 | ## 两个集合的运算 104 | 105 | ### 并 106 | 107 | 给定集合 `A` 和 `B`,两个集合的并由出现在 `A` 或 `B` 中的项构成,记作 `A ∪ B`。 108 | 109 | ``` 110 | A ∪ B = { x : x ∈ A ∪ x ∈ B } 111 | ``` 112 | 113 | ### 交 114 | 115 | 给定集合 `A` 和 `B`,两个集合的交由出现在 `A` 和 `B` 中的项构成,记作 `A ∩ B`。 116 | 117 | ``` 118 | A ∩ B = { x : x ∈ A, x ∈ B } 119 | ``` 120 | 121 | ### 差 122 | 123 | 给定集合 `A` 和 `B`,`A` 对于 `B` 的集合差指的是属于 `A` 但不属于 `B` 的每一项。 124 | 125 | ``` 126 | A \ B = { x : x ∈ A, x ∉ B } 127 | ``` 128 | 129 | ### 对称差 130 | 131 | 给定集合 `A` 和 `B`,对称差指的是属于 `A` 或 `B` 但不属于它们交集的所有项。 132 | 133 | ``` 134 | A △ B = { x : ((x ∈ A) ∩ (x ∉ B)) ∪ ((x ∈ B) ∩ (x ∉ A)) } 135 | 136 | A △ B = (A \ B) ∪ (B \ A) 137 | ``` 138 | 139 | ### 笛卡尔积 140 | 141 | 给定集合 `A` 和 `B`,`A` 和 `B` 的笛卡尔积由 `A` 和 `B` 的项的所有组合构成。 142 | 143 | ``` 144 | A × B = { (x, y) | x ∈ A, y ∈ B } 145 | ``` 146 | -------------------------------------------------------------------------------- /zh-cn/sql.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Bob DuCharme", "http://bobdc.com/"] 4 | translators: 5 | - ["Shuxin Shu", "https://github.com/NamelessAshone"] 6 | --- 7 | 8 | 结构化查询语言(SQL)是一个ISO标准语言,用于创建和管理数据库, 9 | 这种数据库存储一系列表。不同的实现通常会添加特有的语言扩展; 10 | [不同SQL实现的比较(Comparison of different SQL implementat- 11 | ions)](http://troels.arvin.dk/db/rdbms/)是一份很好的产品差 12 | 异参考文档。 13 | 14 | 不同的实现通常会提供一个命令行用于交互式键入命令和显示输出, 15 | 同时这些实现也会提供一种执行脚本文件的方法。(如何退出命令行 16 | 就是就是SQL中尚未被标准化部分的一个典型例子,绝大多数SQL实 17 | 现支持关键字QUIT、EXIT或者两者。) 18 | 19 | 本文的实例命令假设你已经加载了[GitHub](https://github.com/datacharmer/test_db)上的[MySQL示例员工数据库](https://dev.mysql.com/doc/employee/en/)。 20 | 运行脚本的语法取决于你使用的SQL实现。通常是一个命令行工具。 21 | 22 | ```sql 23 | -- 注释以两个连字符开始。命令以分号结束。 24 | 25 | -- SQL关键字大小写不敏感。在下文的示例命令中关键字大写, 26 | -- 因为大写更容易区分数据库、表和列名。 27 | 28 | -- 创建和删除一个数据库。数据库名和表名是大小写敏感的。 29 | CREATE DATABASE someDatabase; 30 | DROP DATABASE someDatabase; 31 | 32 | -- 列出可用的数据库。 33 | SHOW DATABASES; 34 | 35 | -- 使用某个已经存在的数据库 36 | USE employees; 37 | 38 | -- 从当前的departments表,选择所有的行和列 39 | -- 解释器的默认行为是将结果打印在屏幕上。 40 | SELECT * FROM departments; 41 | 42 | -- 检索departments表中所有的行,但只取dept_no和dept_name列。 43 | -- 一条命令可以跨越多行 44 | SELECT dept_no, 45 | dept_name FROM departments; 46 | 47 | -- 检索departments表中所有的行,但是只输出5行。 48 | SELECT * FROM departments LIMIT 5; 49 | 50 | -- 检索departments表中dept_name列包含子串'en'的行。 51 | SELECT dept_name FROM departments WHERE dept_name LIKE '%en%'; 52 | 53 | -- 检索departmnets表中所有dept_name列值为'S'开头并且'S'后接4个字符的行。 54 | SELECT * FROM departments WHERE dept_name LIKE 'S____'; 55 | 56 | -- 检索title表中所有行,不显示重复的行。 57 | SELECT DISTINCT title FROM titles; 58 | 59 | -- 和上面的查询相同,但是以title的值排序(大小写敏感)。 60 | SELECT DISTINCT title FROM titles ORDER BY title; 61 | 62 | -- 计算departments表的总行数。 63 | SELECT COUNT(*) FROM departments; 64 | 65 | -- 计算departments表中dept_name列以'en'字段开头的行的数量。 66 | SELECT COUNT(*) FROM departments WHERE dept_name LIKE '%en%'; 67 | 68 | -- 不同表中信息的JOIN: titles表显示谁有什么工作,员工编号, 69 | -- 入职离职时间。检索这些信息,但是使用员工编号作为employees表 70 | -- 的交叉引用,而不是直接使用员工编号,来获得每个员工的名和姓。 71 | -- (同时只取10行) 72 | 73 | SELECT employees.first_name, employees.last_name, 74 | titles.title, titles.from_date, titles.to_date 75 | FROM titles INNER JOIN employees ON 76 | employees.emp_no = titles.emp_no LIMIT 10; 77 | 78 | -- 列出所有数据库中所有的表。不同实现通常提供各自的快捷命令 79 | -- 来列出当前使用数据库的所有表。 80 | SELECT * FROM INFORMATION_SCHEMA.TABLES 81 | WHERE TABLE_TYPE='BASE TABLE'; 82 | 83 | -- 在当前使用的数据库中,创建一个名为tablename1的表,包含下 84 | -- 述两列。许多其它选项可用于定制列,比如列的数据类型。 85 | CREATE TABLE tablename1 (fname VARCHAR(20), lname VARCHAR(20)); 86 | 87 | -- 向tablename1表插入一行数据。假设该表已经定义并且接受这些值。 88 | INSERT INTO tablename1 VALUES('Richard','Mutt'); 89 | 90 | -- 更新tablename1表中lname为'Mutt'的行fname的值改为'John'。 91 | UPDATE tablename1 SET fname='John' WHERE lname='Mutt'; 92 | 93 | -- 删除tablename1表lname列以'M'开头的行。 94 | DELETE FROM tablename1 WHERE lname like 'M%'; 95 | 96 | -- 删除tablename1表的所有行,留下空表。 97 | DELETE FROM tablename1; 98 | 99 | -- 删除整个tablename1表。 100 | DROP TABLE tablename1; 101 | ``` 102 | -------------------------------------------------------------------------------- /zh-cn/xml.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["João Farias", "https://github.com/JoaoGFarias"] 4 | translators: 5 | - ["Zach Zhang", "https://github.com/checkcheckzz"] 6 | --- 7 | 8 | XML是一种标记语言,被设计用来存储数据和传输数据。 9 | 10 | 不像HTML, XML不指定怎样显示或格式化数据,只是携带它。 11 | 12 | 13 | * XML 语法 14 | 15 | ```xml 16 | 17 | 18 | 19 | 20 | 21 | Everyday Italian 22 | Giada De Laurentiis 23 | 2005 24 | 30.00 25 | 26 | 27 | Harry Potter 28 | J K. Rowling 29 | 2005 30 | 29.99 31 | 32 | 33 | Learning XML 34 | Erik T. Ray 35 | 2003 36 | 39.95 37 | 38 | 39 | 40 | 47 | 48 | 49 | 50 | 57 | 58 | 59 | 60 | computer.gif 61 | ``` 62 | 63 | * 良好格式的文件 x 验证 64 | 65 | 一个XML文件是良好格式的如果它是语法正确的。 66 | 但是, 使用文件定义,比如DTD和XML概要,在文件中插入更多的限制是可能的。 67 | 68 | 一个遵守一个文件定义的XML文件被叫做有效的,对于那个文件来说。 69 | 70 | 有了这个工具,你能够在应用逻辑之外检查XML数据。 71 | 72 | ```xml 73 | 74 | 75 | 76 | 77 | 78 | 79 | Everyday Italian 80 | 30.00 81 | 82 | 83 | 84 | 85 | 86 | 89 | 90 | 91 | 92 | 93 | ]> 94 | 95 | 96 | 101 | 102 | 103 | 104 | 105 | 106 | 109 | 110 | 111 | 112 | 113 | ]> 114 | 115 | 116 | 117 | Everyday Italian 118 | 30.00 119 | 120 | 121 | ``` 122 | -------------------------------------------------------------------------------- /zh-tw/pcre.md: -------------------------------------------------------------------------------- 1 | --- 2 | contributors: 3 | - ["Sachin Divekar", "http://github.com/ssd532"] 4 | translators: 5 | - ["Michael Yeh", "https://hinet60613.github.io/"] 6 | --- 7 | 8 | 正規表達式(regular expression,或縮寫為regex, regexp)是一種用來表示搜尋模式的特殊字串。例如,你可以用`/^[a-z]+:/`來從網址`http://github.com`中擷取出`http:`這段http協定名稱。 9 | 10 | 相容Perl正規表達式(Perl Compatible Regular Expressions, PCRE)是一個實作正規表達式的C語言函式庫。此函式庫在1997年被開發出來,在當時面對複雜字串處理時大多會選擇使用Perl。也因為如此,PCRE大多的正規表達式語法都很酷似Perl。PCRE語法被廣泛運用在許多大專案中,包括PHP、Apache、R等。 11 | 12 | PCRE中的超字元(metacharacter)主要可以分為以下兩類: 13 | 14 | * 在中括號外會被辨識的字元 15 | 16 | ``` 17 | \ 通用跳脫字元 18 | ^ 字串開頭 或 行首 19 | $ 字串結尾 或 行尾 20 | . 除了換行符號外的任何字元 21 | [ 字元集合定義開始 22 | | 支流開始 23 | ( 子串模式定義開始 24 | ) 子串模式定義結束 25 | ? extends the meaning of ( 26 | 同時為數量0或1配對 27 | also quantifier minimizer 28 | * 量詞 至少0個 至多無限個 29 | + 量詞 至少1個 至多無限個 30 | 同時為佔有型量詞 31 | { 最大/最小量詞開始 32 | ``` 33 | 34 | * 在中括號內會被辨識的超字元,在中括號外會被視為字元集合使用 35 | 36 | ``` 37 | \ 通用跳脫字元 38 | ^ 非字元集合的字,但只會抓到第一個符合的字元 39 | - 字元範圍 40 | [ POSIX字元集合(若後面接POSIX格式) 41 | ] 字元集合定義結束 42 | ``` 43 | 44 | PCRE提供了一些通用的字元類型,可被當作字元集合使用 45 | 46 | ``` 47 | \d 任何數字字元 48 | \D 任何非數字字元 49 | \h 任何水平空白字元 50 | \H 任何非水平空白字元 51 | \s 任何空白字元 52 | \S 任何非空白至元 53 | \v 任何垂直空白字元 54 | \V 任何非垂直空白字元 55 | \w 任何英文字 56 | \W 任何非英文字 57 | ``` 58 | 59 | ## 範例 60 | 61 | 我們以字串 `66.249.64.13 - - [18/Sep/2004:11:07:48 +1000] "GET /robots.txt HTTP/1.0" 200 468 "-" "Googlebot/2.1"` 作為範例,這是一個標準的Apache存取記錄。 62 | 63 | | 正規表達式 | 結果 | 說明 | 64 | | :---- | :-------------- | :------ | 65 | | GET | GET | GET 抓取 GET 字串 (會分別大小寫) | 66 | | \d+.\d+.\d+.\d+ | 66.249.64.13 | `\d+` 抓取數字字元,數量由 `+` 定義為至少一個至多無限個。 `\.` 抓取 `.` 字元 | 67 | | (\d+\.){3}\d+ | 66.249.64.13 | `(\d+\.){3}` 會試著抓取剛好三次的 (`\d+\.`) | 68 | | \[.+\] | [18/Sep/2004:11:07:48 +1000] | `.+` 抓取除了換行符號以外的任何字元, `.` 表示任意字元 | 69 | | ^\S+ | 66.249.64.13 | `^` 為行首, `\S+` 抓取至少一個非空白字元 | 70 | | \+[0-9]+ | +1000 | `\+` 抓取 `+` 字元。 `[0-9]` 字元集表示剛好一個數字字元。 可以用 `\+\d+` 達到相同效果。 | 71 | 72 | 以上範例皆可在 [regex101.com](https://regex101.com/) 測試,步驟如下: 73 | 74 | 1. 複製範例字串到 `TEST STRING` 區域 75 | 2. 複製正規表達式字串到 `Regular Expression` 區域 76 | 3. 網頁會顯示自動表達式抓取結果 77 | --------------------------------------------------------------------------------