Skip to content

Instantly share code, notes, and snippets.

@john-eevee
john-eevee / vscode.css
Created April 30, 2019 19:59
custom vscode files
.windows {
/* looking good: Roboto */
font-family: "Work Sans" !important;
}
@john-eevee
john-eevee / .spacemacs
Last active June 7, 2020 18:13
Poor Spacemacs
;; -*- mode: emacs-lisp; lexical-binding: t -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Layer configuration:
This function should only modify configuration layer settings."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
;; `+distribution'. For now available distributions are `spacemacs-base'
defmodule App.Implementations do
def of(key) do
with impls when is_list(impls) <- Application.get_env(:app, :impls),
{:ok, module} <- Keyword.fetch(impls, key) do
module
else
:error ->
raise KeyError,
message: """
:#{key} key is not defined in the implementations for application :app
@john-eevee
john-eevee / active_users.ex
Created April 3, 2019 05:32
Use behaviours to declare interfaces and decouple implementations from business logic
defmodule Project.ActiveUsers do
@behaviour Project.UseCase
def run(params, deps) do
deps[:repo].fetch_users(params)
end
end
@john-eevee
john-eevee / event.exs
Last active March 1, 2019 20:12
Grouping entries by date on Scala | Elixir
defmodule Event do
@type t() :: %__MODULE__{date: Date.t(), title: String.t(), content: String.t()}
defstruct :date, :title, :content
def group(events) do
events
|> Enum.group_by(fn event -> envent.date)
|> Map.to_list()
@john-eevee
john-eevee / pure-impure.md
Last active February 25, 2019 19:17 — forked from tomekowal/pure-impure.md
Pure vs impure

Pure vs impure and why should I care?

Some of the most important advancements in programming came from adding restrictions to the way we program. Famous article by Edsger Dijkstra Go To Statement Considered Harmful shows how introducing one statement into programming language breaks many nice properties of that language. goto gives us freedom and solves couple of simple problems like breaking from nested loops easily, but it can make programs very hard to understand. This happens, because we cannot look at two pieces of code in separation. The execution can jump to some other place in code or even worse: it can jump from other piece of code to here and We need to keep that in mind.

@john-eevee
john-eevee / ENV.md
Last active February 15, 2019 17:33
Idea of Documentation for declaring environment configurations

Service: Blog

<< Description >>

Thrid Party Dependencies

Thrid party depedencies used by this service:

| Service | Protocol | Documentation | Env Vars |

@john-eevee
john-eevee / webpack.config.js
Created January 4, 2019 02:13
phoenix webapck
const path = require('path');
const glob = require('glob');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const paths = {
static: path.join(__dirname, "../priv/static"),
build: path.join(__dirname, "../priv/static"),
node_modules: path.join(__dirname, "./node_modules"),
@john-eevee
john-eevee / README.md
Created December 26, 2018 05:28
quick script to generate files
  • Create file on .templates folder at user home: mkdir ~/.templates/elixir && touch ~/.templates/elixir/module
  • Contents:
defmodule {{mod}} do
end

Usage: bob -tpl elixir/module -d ./person.ex -v mod=Person

Templates are based on handlebars rendered by aymerick/raymond

const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const devMode = process.env.NODE_ENV !== 'production'
module.exports = {
entry: './src/main/resources/assets/js/index.js',
output: {
filename: './js/index.js',
path: __dirname + '/src/main/resources/static/'
},
module: {