$ cabal install yesod
$ runhaskell helloworld.hs
# pattern matching on blocks | |
def print_break(msg) | |
puts '-' * 50, msg | |
end | |
print_break 'normal params' | |
block = -> (one, two) { p one, two } | |
block.call(1, 2) | |
# 1 |
module DoNotation where | |
-- without do notation | |
-- applying only >>= | |
monadChainSuccess1 = Just "hello" >>= \xs -> | |
Just (xs ++ " ") >>= \ys -> | |
Just (ys ++ "world") | |
-- applying >>= and >> |
import Data.List | |
frase = "vaca batata galinha batata coxinha macaco batata vaca batata" | |
wordCounter frase = | |
nub $ map (\x -> (x, length $ filter (== x) palavras)) palavras | |
where palavras = words frase | |
-- [("vaca",2),("batata",4),("galinha",1),("coxinha",1),("macaco",1)] |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
using System; | |
public class InferenciaDeTipo | |
{ | |
public static void Main(String[] args) | |
{ | |
int valor1 = 10; | |
String valor2 = "Valor"; | |
var permitido1 = 1; |
<!DOCTYPE html> | |
<html lang="pt-BR"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Audio and video</title> | |
</head> | |
<body> | |
<!-- Audio --> | |
<audio src="musica.ogg" controls="true" autoplay="true" /> |
List deleted files and removes each
$ git ls-files -d | xargs git rm
Show a text-based graphical representation
$ git log --graph
Ignoring changes in tracked files
100.times {|n| puts (if n % 3 == 0 && n % 5 == 0; 'FizzBuzz'; elsif n % 3 == 0; 'Fizz'; elsif n % 5 == 0; 'Buzz'; else; n; end)} |
/* | |
* FizzBuzz | |
* http://dojopuzzles.com/problemas/exibe/fizzbuzz/ | |
*/ | |
using System; | |
using System.Text; | |
namespace FizzBuzz | |
{ |