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
class SudokuSolver | |
def initialize (m_input = Array.new(9) { [] }, m_solve = Array.new(9) { [] }) | |
@m_input = m_input | |
@m_solve = m_solve | |
0.upto(80) do |i| | |
set_cell(i, 0, @m_input) | |
set_cell(i, 0, @m_solve) | |
end | |
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
package controllers | |
import play.api._ | |
import play.api.mvc._ | |
import scala.concurrent.{ExecutionContext, Future} | |
import play.api.libs.concurrent.Execution.Implicits._ | |
import play.api.libs.ws.WS | |
object Application extends Controller { | |
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 IndependentSet { | |
def printMatrix(matrix: List[List[Int]]): Unit = { | |
matrix.foreach(row => println(row.mkString(" | "))) | |
} | |
def addVertex(matrix: List[List[Int]], neighbours: List[Int]): List[List[Int]] = { | |
matrix | |
.zipWithIndex | |
.map { | |
case (row, index) => row ::: List(if (neighbours.contains(index)) 1 else 0) |
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 java.util.PriorityQueue; | |
import java.util.Random; | |
public class Main3 { | |
public class Tuple implements Comparable<Tuple> { | |
final int hash; | |
final long value; | |
public Tuple(long value, int hash) { | |
this.value = value; |
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
get "/throw-test-1" do | |
throw :some_failure | |
end | |
get "/throw-test-2" do | |
Task.start_link(fn -> throw :some_failure end) | |
# Wait for task in some way | |
end | |
defp handle_errors(conn, %{kind: _kind, reason: _reason, stack: _stack} = hej) do |
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
defmodule Hello do | |
defstruct yo: "" | |
end | |
defimpl Inspect, for: Hello do | |
import Inspect.Algebra | |
def inspect(_thing, _opts) do | |
concat ["test"] | |
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
defmodule Router do | |
use Plug.Router | |
plug Plug.Parsers, parsers: [:urlencoded, :json], | |
pass: ["text/*"], | |
json_decoder: Poison | |
plug :match | |
plug :dispatch | |
post "test" do |
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
defmodule P5 do | |
def work(num, list, target, result \\ "") | |
def work(num, [], target, result) do | |
if num == target, do: IO.puts "#{result}#{num |> abs |> to_string}" | |
end | |
def work(num, [head | tail], target, result) do | |
work(head, tail, target - num, "#{result}#{abs(num)} + ") | |
work(-head, tail, target - num, "#{result}#{abs(num)} - ") |
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
"abcdef" |> String.split("", trim: true) |> Enum.chunk(3, 1) |> Enum.map(&Enum.join/1) |
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 System.Directory | |
import Codec.Picture | |
import Data.Either | |
type RGB = (Int, Int, Int) | |
main :: IO () | |
main = | |
run "blocks" 1 "/Users/anton/Downloads/fantasy_art_blizzard_entertainment_artwork_starcraft_heart_of_desktop_1920x1080_hd-wallpaper-949727.png" "test3.html" |
OlderNewer