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 FeedItemProducer do | |
use GenStage | |
def start_link(:nameless) do | |
GenStage.start_link(__MODULE__, :ok) | |
end | |
def start_link() do | |
GenStage.start_link(__MODULE__, :ok, name: __MODULE__) | |
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 MyApp.AccountLookup.Cache do | |
@moduledoc """ | |
Provides a cache that can be used for account lookups. This cache is backed by | |
Cachex for local storage and pg2 for remote distribution. Keys are set to expire | |
after 7-10 days (randomly distributed) in order to prevent stale data in our cache | |
over a long time period. | |
""" | |
use Cachex.DistributedCache |
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
# We use this ClusterLoadBalancer to prevent hot nodes in our load balanced setup. | |
# The WebSockets are provided by Phoenix through the PushEx application https://github.com/pushex-project/pushex/ | |
# The load balancer's `Worker` module is where the bulk of the cluster orchestration happens, using pg2 for cross node communication | |
defmodule ClusterLoadBalancer.Behavior do | |
@moduledoc """ | |
Behavior for implementing a ClusterLoadBalancer compatible tool. | |
""" | |
@callback count() :: number |
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 { Pushex } from 'pushex' | |
import { getToken } from './tokenService' | |
const pushexOptions = { | |
getParams: () => getToken().then(({ token }) => Promise.resolve({ token })), | |
onConnectionError: pushex => { | |
pushex.resetParams() | |
}, | |
} |
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 SteveTrollsElixir.Private do | |
defmacro __using__(_) do | |
quote do | |
import unquote(__MODULE__) | |
@on_definition {unquote(__MODULE__), :on_priv_def} | |
end | |
end | |
defmacro private() do | |
quote 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
{ | |
"contentTypes": [ | |
{ | |
"sys": { | |
"space": { | |
"sys": { | |
"type": "Link", | |
"linkType": "Space", | |
"id": "hq8sy8wk8n0y" | |
} |
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 TestRouter do | |
def build(routes) do | |
contents = | |
quote do | |
use Plug.Router | |
plug :match | |
plug :dispatch | |
Enum.map(unquote(Macro.escape(routes)), fn %{match: match, assign: assign} -> |
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
{% if user %} | |
<script> | |
window.intercomSettings = { | |
app_id: "YOUR_APP_ID", | |
user_id: "{{ user.id }}", | |
email: "{{ user.email }}", | |
user_hash: "{{ user.id | encrypt: "hmac", "YOUR_IDENTITY_VERIFICATION_SECRET" }}" | |
}; | |
</script> | |
{% else %} |
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
<script type="text/javascript"> | |
if (window.top !== window.self) { | |
const msg = { | |
urlChange: { | |
pathname: window.location.pathname, | |
search: window.location.search, | |
href: window.location.href | |
} | |
} | |
window.top.postMessage(msg, '*') |
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
<!-- Note: un-minified source code available at clove-embed.js --> | |
<script type="text/javascript" src="https://public-cdn.cloveapp.io/clove-embed.min.js"></script> | |
<script type="text/javascript"> | |
CloveEmbed.installFrameListener() | |
CloveEmbed.setFrameUrl("https://yourhub.example.com") | |
</script> |