This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.concurrent.ExecutionContext.Implicits.global | |
import cats.effect.IO | |
import cats.implicits._ | |
object CatsIOParallelApp extends App { | |
def printThreadId(msg: String) = | |
println(s"${Thread.currentThread.getId} : $msg") | |
def io(x: String) = IO { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Solution to https://github.com/danielytics/sherlock-and-array/ | |
; Functional Kata meetup https://www.meetup.com/FunctionalKubs/events/246876977/ | |
(defn solve | |
[s] | |
( | |
let [total (reduce + s)] | |
(defn balanced [arr, accum] | |
(if (<= (count arr) 1) | |
false | |
( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Very simple HTTP server in python. | |
Usage:: | |
./dummyserve [<port>] | |
Send a GET request:: | |
curl http://localhost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Minesweeper extends App { | |
/* | |
* Solution to http://codingdojo.org/kata/Minesweeper/ (sort of, doesn't read from stdin) | |
*/ | |
type Row = Int | |
type Col = Int | |
def emptyMap= Map[(Row, Col), Int]().withDefaultValue(0) | |
val rowLen = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
⍝ Solution that takes a string which may contain parentheses: | |
⍝ * Get the maximum depth | |
⍝ * Check that it is balanced | |
depths←{+\(1 ¯1 0)['()'⍳⍵]} | |
balanced←{⌊/depths ⍵} | |
max_depth←{⌈/depths ⍵} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# A solution to the problem defined at https://github.com/marjaimate/runlength/ | |
# | |
defmodule Runlength do | |
def encode(string) do | |
String.codepoints(string) | |
|> Enum.reverse | |
|> Enum.reduce([], &char_to_tuples/2) | |
|> Enum.reduce("", fn ({char, count}, acc) -> "#{acc}#{Integer.to_string(count)}#{char}" end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name wanderbat - remove ad block overlay | |
// @version 0.1 | |
// @description Remove ad block overlay annoyance from wanderbat site | |
// @author [email protected] | |
// @match http://airlines.wanderbat.com/ | |
// @grant none | |
// @require http://code.jquery.com/jquery-1.12.4.min.js | |
// ==/UserScript== |