This file contains hidden or 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 functional FizzBuzz (without any integer modulus or division) in Elixir | |
# https://pragprog.com/magazines/2012-08/thinking-functionally-with-haskell | |
nums = Stream.iterate(1, &(&1 + 1)) | |
fizz = Stream.cycle ["", "", "Fizz"] | |
buzz = Stream.cycle ["", "", "", "", "Buzz"] | |
fizzbuzz = Stream.zip(fizz, buzz) |> Stream.zip(nums) |> Stream.map(fn | |
{{"", "" }, number} -> number | |
{{fizzword, buzzword}, _number} -> fizzword <> buzzword | |
end) | |
fizzbuzz |> Stream.take(100) |> Enum.each(&IO.puts/1) |
Based on tests on my machine (2013 MacBook Pro, 2.6 GHz i7, 16 GB RAM) generated by https://github.com/pragdave/map_performance
Elixir v1.0.4
This file contains hidden or 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
# By default, GenEvent event handlers fail silently and are not automatically restarted. Not good. | |
# There's an easy enough way to correct this. | |
# You'll need to | |
# 1. define a supervised event manager as a GenServer, | |
# 2. register its GenEvent handlers with monitoring enabled | |
# 3. catch handler exits as "out of band" messages (handle_info) | |
# 4. stop the event manager when any handler crashes, relying on the supervisor to restart the event | |
# manager who will then restart all of its GenEvent handlers. | |
# This approach assumes that event handling is either stateless or can reset its state without issues. |
This file contains hidden or 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
Mute these words in your settings here: https://twitter.com/settings/muted_keywords | |
ActivityTweet | |
generic_activity_highlights | |
generic_activity_momentsbreaking | |
RankedOrganicTweet | |
suggest_activity | |
suggest_activity_feed | |
suggest_activity_highlights | |
suggest_activity_tweet |
This file contains hidden or 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 GenysysWeb.SectionTemplateArrayHelpers do | |
use Phoenix.HTML | |
""" | |
Use like (In template): | |
<%= map_array_input f, :features, ["title", "body", "color", "icon"] %> | |
<%= map_array_add_button f, :features, ["title", "body", "color", "icon"] %> | |
Result %{"0" => %{args..}} | |
""" |
You also might wanna just use Whisky which does this automatically
This guide works on macOS 13.4+ using Command Line Tools for XCode 15 Beta!
In the recent WWDC, Apple announced and released the "game porting toolkit", which upon further inspection this is just a modified version of CrossOver's fork of wine which is a "compatibility layer" that allows you to run Windows applications on macOS and Linux.
OlderNewer