Skip to content

Instantly share code, notes, and snippets.

@cschneid
cschneid / formatted_store.ex
Last active June 6, 2017 21:07
A Comparison of ScoutApm's elixir agent's store.ex before & after running (a very early version of) exfmt on it.
defmodule ScoutApm.Store do
@moduledoc "Singleton that manages the state of the Agent's data. Mostly just\nroutes data to the correct per-minute data structure\n\nAlso is the core \"tick\" of the system, so each X seconds, the data\ncollected is checked to see if it's ready to be reported. If so, the\nreporting process is kicked off.\n"
use GenServer
alias ScoutApm.Internal.Metric
alias ScoutApm.Internal.WebTrace
alias ScoutApm.Internal.JobRecord
alias ScoutApm.Internal.JobTrace
alias ScoutApm.StoreReportingPeriod
@cschneid
cschneid / Elm.rake
Created December 9, 2016 18:25 — forked from coreyhaines/Elm.rake
Rake task to compile/copy elm
namespace :elm do
Apps = [ "WorkspaceMain", "ManageSubscribersMain", "NotebookMain", "ResponsesMain" ]
JsFileName = "irn_elm.js"
JsOutputDir = "app/assets/javascripts"
desc "Updates packages, compiles the Elm code and copies it to #{JsOutputDir}"
task :compile_and_copy => [:package_install, :make, :copy] do
puts "Updated Packages, Compiled and copied Elm code to #{JsOutputDir}"
end
module LoginForm (Model, init, Action, update, view) where
import Html exposing (..)
import Html.Attributes exposing (value, placeholder)
import Html.Events exposing (on, targetValue, onClick)
import Http
import Json.Decode as Json
import Effects
import Task
require 'benchmark'
CALLER = caller
REGEX = /(\/app\/(controllers|models|views)\/.+)/.freeze
def constant_regex
CALLER.each { |x| x.match(REGEX) }
end
def literal_regex
fn main() {
let mut g = Game::new(10, 10);
g.alive(0,0);
g.alive(2,2);
let ns = g.neighbors(1,1);
println!("{:?}", ns);
println!("{}", g.format());
}
#[derive(Debug)]
import Signal exposing (Signal, Address)
import Html exposing (Html, div, button, text)
import Html.Events exposing (onClick)
import Task
main : Signal Html
main =
start { model = model
, view = view
, update = update }
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE FlexibleInstances #-}
module Grocery.Database.Calendar where
import Grocery.DatabaseSchema
import Grocery.Types.Meal
import Grocery.Types.Recipe
import Grocery.Types.Food
import Database.Persist
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE FlexibleInstances #-}
module Grocery.Database.Calendar where
import Grocery.DatabaseSchema
import Grocery.Types.Meal
import Database.Persist
import Database.Persist.Sqlite
import qualified Database.Esqueleto as E
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FunctionalDependencies #-}
module Grocery.Database.Calendar where
import Grocery.DatabaseSchema
import Grocery.Types.Meal
import Database.Persist
import Database.Persist.Sqlite
import qualified Database.Esqueleto as E
import Database.Esqueleto ((^.))
module Grocery.Database.Calendar where
import Grocery.DatabaseSchema
import Grocery.Types.Meal
import Database.Persist
import Database.Persist.Sqlite
import qualified Database.Esqueleto as E
import Database.Esqueleto ((^.))
import Data.Time
import Data.Text