Skip to content

Instantly share code, notes, and snippets.

View lpil's full-sized avatar

Louis Pilfold lpil

View GitHub Profile
@lpil
lpil / gist:f3128d8c222b6fb0c7ee
Created October 23, 2015 16:49 — forked from alco/gist:2165064
Count the number of non-blank SLOC in an Elixir project
git ls-files | egrep '\.erl|\.ex[s]$' | xargs cat | sed '/^$/d' | wc -l
@lpil
lpil / README.md
Created March 22, 2016 14:29 — forked from joakimk/README.md
CircleCI elixir build example

This runs a build for a small elixir (phoenix) project in about 40 seconds by caching as much of the compiled files as possible.

We've been using this for months in multiple projects without any issues. Please ping be if there is any issues with this script and I'll update it.

It should be generic enough to work on any elixir app using mix.

If you have a elixir_buildpack.config, then enable that section in the build script to keep versions in sync!

@lpil
lpil / phoenix showdown rackspace onmetal io.md
Created June 14, 2016 21:33 — forked from omnibs/phoenix showdown rackspace onmetal io.md
Phoenix Showdown Comparative Benchmarks @ Rackspace

Comparative Benchmark Numbers @ Rackspace

I've taken the benchmarks from Matthew Rothenberg's phoenix-showdown, updated Phoenix to 0.13.1 and ran the tests on the most powerful machines available at Rackspace.

Results

Framework Throughput (req/s) Latency (ms) Consistency (σ ms)
@lpil
lpil / my_app.ex
Created June 17, 2016 10:27 — forked from alanpeabody/my_app.ex
Websockets in Elixir with Cowboy and Plug
defmodule MyApp do
use Application
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
Plug.Adapters.Cowboy.child_spec(:http, MyApp.Router, [], [
dispatch: dispatch
])
print(
"hello"
)
print([
1,
2,
])
vs
defmodule Pattern do
@pattern quote do: {:attr, payload}
defmacro pattern do
quote do: {:macro, payload}
end
def match(unquote(@pattern) = argument) do
@lpil
lpil / oop.js
Created December 5, 2016 23:12
export function makeAnimal({ name, size }) {
const sayHello = () => `Hello, I'm ${name}`;
const isBigger = (other) => size > other.size;
return Object.freeze({
sayHello,
isBigger,
size,
});
module Main where
import Prelude
import Control.Monad.Eff.Console
import Data.Foldable (foldl)
import Data.String as String
import Data.Char as Char
import Data.List as List
import Data.List (List(Nil), (:))
import Data.Array as Array

Pull Request Guidelines

Good code is tested, designed for change, easy to understand and able to cope when things go wrong.

Good pull requests are descriptive, small and short-lived.

For the Author

@lpil
lpil / result.rb
Created April 13, 2017 11:21
Ruby Result Monad
require 'result/ok'
require 'result/error'
#
# A generic representation of success and failure.
#
# Styled after the Result monad of Elm and Rust
# (or the Either monad of Haskell).
#
# The `#and_then` method can be used to chain functions that