iex(1)> :crashdump_viewer.start
// pick file
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 EnumEx do | |
@doc """ | |
Executes `fun` for each `list` element (just like `map`), but if one iter fails, | |
then aborts everything and returns first error. | |
`fun` must return {:ok, result} | {:error, error} | |
""" | |
def map_or_error(list, fun) do | |
result = Enum.reduce(list, [], fn | |
i, acc when is_list(acc) -> |
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
def get do | |
try do | |
{:ok, GenServer.call(__MODULE__, :get)} | |
catch | |
:exit, {reason, _} -> | |
{:error, reason} | |
end | |
end | |
def get! do |
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
class Message extends React.Component { | |
parseLinks(body) { | |
body = body.split(/(http[^ ]+)/) | |
body = body.map(function(url) { | |
if (url.match(/(http[^ ]+)/)) { | |
var href = "/r?url=" + encodeURIComponent(url) | |
var key = Math.random() | |
return <a key={key} href={href} target="_blank">{url}</a> | |
} else { | |
return url |
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 PhoenixApp.Mixfile do | |
use Mix.Project | |
def project do | |
[app: :phoenix_app, | |
# ... | |
aliases: aliases, | |
deps: deps] | |
end |
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
upstream phoenix { | |
server phoenix:8003; | |
} | |
map $http_upgrade $connection_upgrade { | |
default upgrade; | |
'' close; | |
} | |
server { |
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
# Else Heart.Break() | |
# Teleporting radio | |
# Valid items: | |
# - standard radio | |
# Requires: | |
# - this script: https://gist.github.com/remiq/3e53aaa3e5a80029fe81 | |
# installed on: PoliceOfficeInterior_MinistryOfficeWorkstationComputer_1 | |
var tp = Connect("PoliceOfficeInterior_MinistryOfficeWorkstationComputer_1") | |
tp.Teleport("PoliceOfficeInterior") | |
#tp.Teleport("TownHall") |
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
# Else Heart.Break() | |
# Alternative MissingPersonFinder | |
# Valid computers: | |
# - (PoliceOfficeInterior) PoliceOfficeInterior_MinistryOfficeWorkstationComputer_1 | |
# - (TownHall apartment) Playstation | |
Menu() | |
return | |
bool Menu() |
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
defp get!(url) do | |
case HTTPoison.get(url) do | |
{:ok, resp} -> resp | |
resp -> | |
IO.inspect {url, resp} | |
:timer.sleep 5_000 | |
get!(url) | |
end | |
end |