Skip to content

Instantly share code, notes, and snippets.

View scottdavis's full-sized avatar

Scott Davis scottdavis

View GitHub Profile
UI:
- https://github.com/rivo/tview
- https://github.com/fyne-io/fyne
PacketDecoding:
- https://github.com/kgolding/go-decoder
Testing:
- https://github.com/stretchr/testify
# lib/monitor.ex
defmodule MyApp.Monitor do
def health_check do
ExStatsD.histogram(get_concache_mem_size(:css_cache), "css.cache.memory", ["css_cache_memory"])
ExStatsD.histogram(get_concache_mem_size(:sass_cache), "sass.cache.memory", ["sass_cache_memory"])
ExStatsD.histogram(ConCache.size(:css_cache), "css.cache.size", ["css_cache_size"])
ExStatsD.histogram(ConCache.size(:sass_cache), "sass.cache.size", ["sass_cache_size"])
ExStatsD.histogram(:erlang.memory(:ets), "erlang.ets.memory", ["ets_size"])
ExStatsD.histogram(:erlang.memory |> Keyword.get(:total), "erlang.memory.memory", ["ets_size"])
defmodule Monitor do
def health_check do
ExStatsD.histogram(get_concache_mem_size(:css_cache), "css.cache.memory", ["css_cache_memory"])
ExStatsD.histogram(get_concache_mem_size(:sass_cache), "sass.cache.memory", ["sass_cache_memory"])
ExStatsD.histogram(ConCache.size(:css_cache), "css.cache.size", ["css_cache_size"])
ExStatsD.histogram(ConCache.size(:sass_cache), "sass.cache.size", ["sass_cache_size"])
ExStatsD.histogram(:erlang.memory(:ets), "erlang.ets.memory", ["ets_size"])
ExStatsD.histogram(:erlang.memory |> Keyword.get(:total), "erlang.memory.memory", ["ets_size"])
end
@doc """
Converts Elixir map into a sass map
"""
def convert_to_sass(map) when is_map(map) do
"(" <> Enum.map_join(map, ",", fn {k, v} ->
"#{convert_to_sass(k)}:#{convert_to_sass(v)}"
end) <> ")"
end
@doc """
Converts Elixir atom into its corresponding sass value
@scottdavis
scottdavis / SassMeister-input-HTML.html
Created September 25, 2015 19:57
Generated by SassMeister.com.
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<section class='display-pane-container'>
<div class='media' style='max-width:1200px;'>
<div class='photo'>
<img src='http://placecage.com/1200/700' class='player-photo' />
</div>
<div class='left-control'>
<span class='fa fa-arrow-circle-o-left fa-3x'></span>
</div>
<div class='right-control'>
@scottdavis
scottdavis / SassMeister-input-HTML.html
Created September 24, 2015 19:40
Generated by SassMeister.com.
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<section class='display-pane-container'>
<div class='media' style='max-width:700px;max-height:1200px;'>
<div class='photo'>
<img src='http://placecage.com/700/1200' class='player-photo' />
</div>
<div class='photo ng-hide'>
<img src='http://placecage.com/1200/700' class='player-photo' />
</div>
<div class='left-control'>
@scottdavis
scottdavis / SassMeister-input-HTML.html
Last active August 29, 2015 14:26
Generated by SassMeister.com.
<div class='container'>
<div class='agent'>
<div class='profile content'>
<img src='http://www.placecage.com/200/300' />
</div>
<div class='logo content'>
<img src='http://www.placecage.com/200/125' />
</div>
<div class='name content'>
<p>Nick Cage</p>
@scottdavis
scottdavis / SassMeister-input-HTML.html
Created August 4, 2015 15:31
Generated by SassMeister.com.
<div class='container'>
<div class='agent'>
<div class='profile'>
<img src='http://www.placecage.com/200/300' />
</div>
</div>
<div class='agent'>
<div class='profile'>
<img src='http://www.placecage.com/200/300' />
</div>
@scottdavis
scottdavis / SassMeister-input.scss
Created May 1, 2015 00:54
Generated by SassMeister.com.
// ----
// libsass (v3.1.0)
// ----
// We are generating this in forceBase.scss:
$spacing-xxx-small: 0.125rem;
$spacing-xx-small: 0.25rem;
$spacing-x-small: 0.5rem;
$spacing-small: 0.75rem;
$spacing-medium: 1rem;
@scottdavis
scottdavis / SassMeister-input.scss
Created April 21, 2015 18:39
Generated by SassMeister.com.
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
$config: (
color-red: red,
color-blue: blue,
color-black: black,
color-white: white,