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 DataMuging do | |
def processLines [], result, _cols do | |
result | |
end | |
def processLines [head | tail], result, { fst, scd, thd } do | |
if Regex.match?(%r/^\s*\d+.?\s+/, head) do | |
s = String.split head | |
processLines tail, [ { Enum.at(s, fst), |
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 SleepSort do | |
def sort(list_of_numbers) do | |
{:ok, sorted_list} = Agent.start(fn -> [] end) | |
Enum.map(list_of_numbers, fn number -> | |
Task.start(fn -> | |
:timer.sleep(number * 1) | |
Agent.update(sorted_list, fn l -> [ number | l ] 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
defmodule Brainfuck do | |
@moduledoc """ | |
Brainfuck, s. http://en.wikipedia.org/wiki/Brainfuck | |
""" | |
@register_size 100 | |
# Function to find the next corresponding closing bracket | |
defp find_closing_bracket([ 91 | rest ], pos, closing) 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
elm-stuff/ | |
*.html | |
*.js |
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
{ | |
"links": [ | |
{ | |
"source": 0, | |
"target": 10, | |
"value": 1 | |
}, | |
{ | |
"source": 0, | |
"target": 12, |
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 SearchTweets do | |
# number of tweets that are provided with one request | |
# the twitter api allows maximum 100 | |
@chunk_size 100 | |
defp fetch_next(term, options) do | |
try do | |
ExTwitter.search(term, options) | |
rescue |
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
module Slides where | |
import Markdown | |
import Keyboard | |
import Html exposing (Html) | |
-- Data | |
type alias Slide = String | |
type alias SlideZipper = ( List Slide, List Slide ) |
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
module PortsExample where | |
import Graphics.Element exposing (show) | |
type alias MyModel = ( Int, List Int ) | |
initialModel : MyModel | |
initialModel = ( 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
module MyIntList exposing (..) | |
type MyList = Nil | Cons Int MyList | |
(#) : Int -> MyList -> MyList | |
(#) ele list = | |
Cons ele list | |
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
module RegisterMachine exposing (..) | |
import Html | |
import Time exposing (Time, second) | |
import Array exposing (Array) | |
import Html exposing (..) | |
import Html.Attributes exposing (style) | |
type Msg |
OlderNewer