From 458bbd063ad78c3ba6b0d114226f94edf0dab708 Mon Sep 17 00:00:00 2001 From: Julien Cretel Date: Fri, 21 Nov 2014 17:28:38 +0000 Subject: [PATCH 1/8] Fix some inaccuracies in haskell.html.markdown - The bottom of the "List and Tuples" section may mislead the reader into thinking that the `fst` and `snd` functions can be applied to any tuple; it's worth mentioning that those functions only apply to pairs. - The example demonstrating the use of the function-application operator (`$`) in combination with the function-composition operator (`.`) seems a bit contrived. For completeness, I've added an example that uses `$` alone. - "If statements" and "case statements" are actually expressions, in Haskell; I've replaced all occurences of the word "statement" appearing in that context by the word "expression". - Minor wording improvement (replaced "because" by a semicolon). --- haskell.html.markdown | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/haskell.html.markdown b/haskell.html.markdown index 2785405c..748a29da 100644 --- a/haskell.html.markdown +++ b/haskell.html.markdown @@ -110,7 +110,7 @@ last [1..5] -- 5 -- A tuple: ("haskell", 1) --- accessing elements of a tuple +-- accessing elements of a pair (i.e. a tuple of length 2) fst ("haskell", 1) -- "haskell" snd ("haskell", 1) -- 1 @@ -195,8 +195,8 @@ foo 5 -- 75 -- fixing precedence -- Haskell has another function called `$`. This changes the precedence -- so that everything to the left of it gets computed first and then applied --- to everything on the right. You can use `.` and `$` to get rid of a lot --- of parentheses: +-- to everything on the right. You can use `$` (often in combination with `.`) +-- to get rid of a lot of parentheses: -- before (even (fib 7)) -- true @@ -204,6 +204,9 @@ foo 5 -- 75 -- after even . fib $ 7 -- true +-- equivalently +even $ fib 7 -- true + ---------------------------------------------------- -- 5. Type signatures ---------------------------------------------------- @@ -227,24 +230,24 @@ double :: Integer -> Integer double x = x * 2 ---------------------------------------------------- --- 6. Control Flow and If Statements +-- 6. Control Flow and If Expressions ---------------------------------------------------- --- if statements +-- if expressions haskell = if 1 == 1 then "awesome" else "awful" -- haskell = "awesome" --- if statements can be on multiple lines too, indentation is important +-- if expressions can be on multiple lines too, indentation is important haskell = if 1 == 1 then "awesome" else "awful" --- case statements: Here's how you could parse command line arguments +-- case expressions: Here's how you could parse command line arguments case args of "help" -> printHelp "start" -> startProgram _ -> putStrLn "bad args" --- Haskell doesn't have loops because it uses recursion instead. +-- Haskell doesn't have loops; it uses recursion instead. -- map applies a function over every element in an array map (*2) [1..5] -- [2, 4, 6, 8, 10] From d179669f3985f8cab479778a1a32f7e02ea3f182 Mon Sep 17 00:00:00 2001 From: Martin Thoresen Date: Mon, 24 Nov 2014 17:37:55 +0100 Subject: [PATCH 2/8] fix #873 --- c.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c.html.markdown b/c.html.markdown index 874197d3..f44da38e 100644 --- a/c.html.markdown +++ b/c.html.markdown @@ -629,7 +629,7 @@ typedef void (*my_fnp_type)(char *); ## Further Reading Best to find yourself a copy of [K&R, aka "The C Programming Language"](https://en.wikipedia.org/wiki/The_C_Programming_Language) -It is *the* book about C, written by the creators of C. Be careful, though - it's ancient and it contains some +It is *the* book about C, written by Dennis Ritchie, the creator of C, and Brian Kernighan. Be careful, though - it's ancient and it contains some inaccuracies (well, ideas that are not considered good anymore) or now-changed practices. Another good resource is [Learn C the hard way](http://c.learncodethehardway.org/book/). From 3a8b9f0fc5397fb824cb49ecf6efd4a0c916b339 Mon Sep 17 00:00:00 2001 From: LOZORD Date: Mon, 24 Nov 2014 19:32:40 -0600 Subject: [PATCH 3/8] Added 'git stash'! --- git.html.markdown | 51 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/git.html.markdown b/git.html.markdown index 618d1906..e064122d 100644 --- a/git.html.markdown +++ b/git.html.markdown @@ -334,6 +334,55 @@ $ git push -u origin master $ git push ``` +### stash + +Stashing takes the dirty state of your working directory and saves it on a +stack of unfinished changes that you can reapply at any time. + +```bash +# Let's say you've been doing some work in your git repo, but you want to pull from the remote. +# Since you have dirty (uncommited) changes to some files, you are not able to run 'git pull'. +# Instead, you can run 'git stash' to save your changes onto a stack! + +$ git stash +Saved working directory and index state \ + "WIP on master: 049d078 added the index file" + HEAD is now at 049d078 added the index file + (To restore them type "git stash apply") + +# Now you can pull! +git pull +# ...changes apply... + +# Now check that everything is OK + +$ git status +# On branch master +nothing to commit, working directory clean + +# You can see what 'hunks' you've stashed so far: +# Since the 'hunks' are stored in a Last-In-First-Out stack +# our most recent change will be at top +$ git stash list +stash@{0}: WIP on master: 049d078 added the index file +stash@{1}: WIP on master: c264051 Revert "added file_size" +stash@{2}: WIP on master: 21d80a5 added number to log + +# Now let's apply our dirty changes back by popping them off the stack +# 'git stash apply' also works too +$ git stash pop +# On branch master +# Changes not staged for commit: +# (use "git add ..." to update what will be committed) +# +# modified: index.html +# modified: lib/simplegit.rb +# + +# Now you're good to go! + +[Additional Reading.](http://git-scm.com/book/en/v1/Git-Tools-Stashing) + ### rebase (caution) Take all changes that were committed on one branch, and replay them onto another branch. @@ -396,4 +445,4 @@ $ git rm /pather/to/the/file/HelloWorld.c * [GitGuys](http://www.gitguys.com/) -* [Git - the simple guide](http://rogerdudler.github.io/git-guide/index.html) \ No newline at end of file +* [Git - the simple guide](http://rogerdudler.github.io/git-guide/index.html) From 8b442c2497962b3b47844da74a416075313dc428 Mon Sep 17 00:00:00 2001 From: LOZORD Date: Mon, 24 Nov 2014 19:39:44 -0600 Subject: [PATCH 4/8] Only bashified the code sections --- git.html.markdown | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/git.html.markdown b/git.html.markdown index e064122d..7778fdd4 100644 --- a/git.html.markdown +++ b/git.html.markdown @@ -336,40 +336,45 @@ $ git push ### stash -Stashing takes the dirty state of your working directory and saves it on a -stack of unfinished changes that you can reapply at any time. +Stashing takes the dirty state of your working directory and saves it on a stack of unfinished changes that you can reapply at any time. + +Let's say you've been doing some work in your git repo, but you want to pull from the remote. +Since you have dirty (uncommited) changes to some files, you are not able to run 'git pull'. +Instead, you can run 'git stash' to save your changes onto a stack! ```bash -# Let's say you've been doing some work in your git repo, but you want to pull from the remote. -# Since you have dirty (uncommited) changes to some files, you are not able to run 'git pull'. -# Instead, you can run 'git stash' to save your changes onto a stack! - $ git stash Saved working directory and index state \ "WIP on master: 049d078 added the index file" HEAD is now at 049d078 added the index file (To restore them type "git stash apply") +``` -# Now you can pull! +Now you can pull! +```bash git pull -# ...changes apply... +``` +...changes apply... -# Now check that everything is OK +Now check that everything is OK +```bash $ git status # On branch master nothing to commit, working directory clean +``` -# You can see what 'hunks' you've stashed so far: -# Since the 'hunks' are stored in a Last-In-First-Out stack -# our most recent change will be at top +You can see what 'hunks' you've stashed so far: +Since the 'hunks' are stored in a Last-In-First-Out stack our most recent change will be at top +```bash $ git stash list stash@{0}: WIP on master: 049d078 added the index file stash@{1}: WIP on master: c264051 Revert "added file_size" stash@{2}: WIP on master: 21d80a5 added number to log +``` -# Now let's apply our dirty changes back by popping them off the stack -# 'git stash apply' also works too +Now let's apply our dirty changes back by popping them off the stack +```bash $ git stash pop # On branch master # Changes not staged for commit: @@ -378,9 +383,10 @@ $ git stash pop # modified: index.html # modified: lib/simplegit.rb # +``` +'git stash apply' also works too -# Now you're good to go! - +Now you're ready to get back to work on your stuff! [Additional Reading.](http://git-scm.com/book/en/v1/Git-Tools-Stashing) ### rebase (caution) From 295b40d2724a24e046f75da71b4e43124168b535 Mon Sep 17 00:00:00 2001 From: LOZORD Date: Mon, 24 Nov 2014 19:41:02 -0600 Subject: [PATCH 5/8] Small formatting changes --- git.html.markdown | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/git.html.markdown b/git.html.markdown index 7778fdd4..7e9e70de 100644 --- a/git.html.markdown +++ b/git.html.markdown @@ -384,9 +384,10 @@ $ git stash pop # modified: lib/simplegit.rb # ``` -'git stash apply' also works too +`git stash apply` does the same thing Now you're ready to get back to work on your stuff! + [Additional Reading.](http://git-scm.com/book/en/v1/Git-Tools-Stashing) ### rebase (caution) From b7f4ca7ea8e831426eeced7b37b09ed1d81a8190 Mon Sep 17 00:00:00 2001 From: LOZORD Date: Mon, 24 Nov 2014 19:44:25 -0600 Subject: [PATCH 6/8] Added ourselves to the contributor section --- git.html.markdown | 2 ++ 1 file changed, 2 insertions(+) diff --git a/git.html.markdown b/git.html.markdown index 7e9e70de..f94fadee 100644 --- a/git.html.markdown +++ b/git.html.markdown @@ -3,6 +3,8 @@ category: tool tool: git contributors: - ["Jake Prather", "http://github.com/JakeHP"] + - ["Leo Rudberg" , "http://github.com/LOZORD"] + - ["Betsy Lorton" , "http://github.com/schbetsy"] filename: LearnGit.txt --- From 0e42f4c928b1414102467f539b313c1646e91093 Mon Sep 17 00:00:00 2001 From: Leo Rudberg Date: Tue, 25 Nov 2014 13:47:03 -0600 Subject: [PATCH 7/8] Fixed some markdown formatting issuses --- git.html.markdown | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/git.html.markdown b/git.html.markdown index f94fadee..04350dd5 100644 --- a/git.html.markdown +++ b/git.html.markdown @@ -341,8 +341,8 @@ $ git push Stashing takes the dirty state of your working directory and saves it on a stack of unfinished changes that you can reapply at any time. Let's say you've been doing some work in your git repo, but you want to pull from the remote. -Since you have dirty (uncommited) changes to some files, you are not able to run 'git pull'. -Instead, you can run 'git stash' to save your changes onto a stack! +Since you have dirty (uncommited) changes to some files, you are not able to run `git pull`. +Instead, you can run `git stash` to save your changes onto a stack! ```bash $ git stash @@ -353,10 +353,11 @@ Saved working directory and index state \ ``` Now you can pull! + ```bash git pull ``` -...changes apply... +`...changes apply...` Now check that everything is OK @@ -366,8 +367,9 @@ $ git status nothing to commit, working directory clean ``` -You can see what 'hunks' you've stashed so far: -Since the 'hunks' are stored in a Last-In-First-Out stack our most recent change will be at top +You can see what "hunks" you've stashed so far using `git stash list`. +Since the "hunks" are stored in a Last-In-First-Out stack, our most recent change will be at top. + ```bash $ git stash list stash@{0}: WIP on master: 049d078 added the index file @@ -375,7 +377,8 @@ stash@{1}: WIP on master: c264051 Revert "added file_size" stash@{2}: WIP on master: 21d80a5 added number to log ``` -Now let's apply our dirty changes back by popping them off the stack +Now let's apply our dirty changes back by popping them off the stack. + ```bash $ git stash pop # On branch master @@ -386,6 +389,7 @@ $ git stash pop # modified: lib/simplegit.rb # ``` + `git stash apply` does the same thing Now you're ready to get back to work on your stuff! From d6ce2aa25941317de46d02567d2b2c7c2127393c Mon Sep 17 00:00:00 2001 From: Pedro Pisandelli Date: Tue, 25 Nov 2014 20:02:54 -0300 Subject: [PATCH 8/8] Fixed some misspelling words for pt-br language --- pt-br/ruby-pt.html.markdown | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pt-br/ruby-pt.html.markdown b/pt-br/ruby-pt.html.markdown index 4a8a1b5c..89a051d4 100644 --- a/pt-br/ruby-pt.html.markdown +++ b/pt-br/ruby-pt.html.markdown @@ -33,7 +33,7 @@ Você não deve usar também 10 * 2 #=> 20 35 / 5 #=> 7 -# Aritimética é apenas açúcar sintático +# Aritmética é apenas açúcar sintático # para chamar um método de um objeto 1.+(3) #=> 4 10.* 5 #=> 50 @@ -129,7 +129,7 @@ array = [1, "Oi", false] #=> => [1, "Oi", false] array[0] #=> 1 array[12] #=> nil -# Como aritimética, o acesso via [var] +# Como aritmética, o acesso via [var] # é apenas açúcar sintático # para chamar o método [] de um objeto array.[] 0 #=> 1 @@ -171,7 +171,7 @@ end # Desde o Ruby 1.9, temos uma sintaxe especial quando usamos símbolos como chaves (keys) -novo_hash = { defcon: 3, acao: true} +novo_hash = {defcon: 3, acao: true} novo_hash.keys #=> [:defcon, :acao] @@ -183,9 +183,9 @@ novo_hash.keys #=> [:defcon, :acao] if true "Se verdadeiro" elsif false - "else if, opicional" + "else if, opcional" else - "else, também é opicional" + "else, também é opcional" end for contador in 1..5 @@ -259,7 +259,7 @@ end # Argumentos de métodos são separados por uma vírgula somar 3, 4 #=> 7 -somar somar(3,4), 5 #=> 12 +somar(3,4), 5 #=> 12 # yield # Todos os métodos possuem implicitamente um paramêntro opcional que é um bloco