Skip to content

Instantly share code, notes, and snippets.

View BenBals's full-sized avatar
🕴️

Ben BenBals

🕴️
View GitHub Profile
image: nixos/nix
build-latex:
stage: build
script:
- nix-build
- cp -Lr result artifacts
artifacts:
paths:
- artifacts

Keybase proof

I hereby claim:

  • I am benbals on github.
  • I am beb (https://keybase.io/beb) on keybase.
  • I have a public key ASAF1WRryvP6q_JLEj7ntv3orw9MY3I6QthkOl_cMnG2YAo

To claim this, I am signing this object:

== Compilation error on file web/controllers/poll_controller.ex ==
** (CompileError) web/controllers/poll_controller.ex:48: undefined function build/3
(stdlib) lists.erl:1337: :lists.foreach/2
(stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
(elixir) lib/kernel/parallel_compiler.ex:100: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/8
@BenBals
BenBals / ampel.java
Last active April 3, 2016 16:36
Eine Ampel/Fußgängerampel für Informatik
public class AMPEL
{
int positionX;
int positionY;
String ampelPhase;
LAMPE lampeOben;
LAMPE lampeMitte;
LAMPE lampeUnten;
AMPEL() {
@BenBals
BenBals / elm-challanges.md
Last active April 7, 2016 16:32
Just some beginner practice problems for Elm.

Elm practice problems

Problems

1 Simple functions

  • 1. 1 Write a function that takes an Integer and returns True or False depending on whether the number is greater than 12.

  • 1. 2 Write a function that takes an Integer and returns True or False depending on whether it is odd. Look up the % operator

  • 1. 3 Write a function that takes a name as a String and returns "Hello, Name!". Look up the ++ operator.

greet "Bob" -> "Hello, Bob!"

@BenBals
BenBals / powerset.hs
Created March 26, 2016 16:02
how to get a powerset of any given list in Haskell. Mind = Blown
import Control.Monad
powerset :: [a] -> [[a]]
powerset = filterM (\n -> [True,False])
@BenBals
BenBals / kightsQuest.hs
Created March 26, 2016 09:52
Make a function that checks whether a knight can reach a certain position on a chess board from a given starting position within 3 moves. Position denoted as (Int,Int)
import qualified Control.Monad as M
type KnightPos = (Int,Int)
moveKnight :: KnightPos -> [KnightPos]
moveKnight (c,r) = do
(c',r') <- [(c+2,r-1),(c+2,r+1),(c-2,r-1),(c-2,r+1)
,(c+1,r-2),(c+1,r+2),(c-1,r-2),(c-1,r+2)
]
M.guard (c' `elem` [1..8] && r' `elem` [1..8])
@BenBals
BenBals / stuff.hs
Last active March 25, 2016 19:36
Add, Subtract, Multiply, Exponentiate
-- Ever wanted to add, subtract, multiply and exponentiate using all possible combinations of 1 and 2 with 3 and 4? No. Well thats how it's done in Haskell anyway. Jup just that single line.
[(+), (-), (*), (^)] <*> [1,2] <*> [3,4]
@BenBals
BenBals / resultA8A2.txt
Last active September 10, 2015 19:24
resultCheckNumber
[(0,0,Nothing),
(1,0,Nothing),
(2,20664,Nothing),
(3,537264,[14,13,12]),
(4,5372640,[14,13,12]),
(5,32029200,[16,15,14]),
(6,137725560,[42,41,40]),
(7,472709664,[43,42,41])]
@BenBals
BenBals / test1.json
Last active August 29, 2015 14:22
karteikarten Test
{
"config": {
"random": "true"
},
"data": [
["Vorderseite 1", "Rückseite 1"],
["Vorderseite 2", "Rückseite 2"]
]
}