Skip to content

Instantly share code, notes, and snippets.

View wende's full-sized avatar

Krzysztof Wende wende

  • Neon Tree Solutions Ltd.
  • Gdańsk, Poland
View GitHub Profile
@wende
wende / Janusz.ex
Last active October 22, 2020 01:19
defmodule Janusz do
def homework() do
1..7
|> Enum.map(fn _ -> :rand.uniform * 10 |> round() end)
|> IO.inspect()
|> Enum.count(fn x -> x > 5 end)
|> Kernel.>(3)
|> case do
true -> "Więcej"
false -> "Mniej"
@wende
wende / control.lua
Last active November 4, 2019 23:53
BlueBuild - Fixed demo for longreach, optimized and fix for recent print bug
-- Find ghosts to place. Then find buildings to destruct.
function runOnce()
global.runOnce = true
if not global.blueBuildFirstTick then
global.blueBuildFirstTick = {}
end
if not global.bluePositions then
global.bluePosition = {}
end
if not global.blueBuildToggle then
module Main exposing (..)
run : String
run =
let
add3 = List.foldl (>>) (\x -> x) [add1, add1, add1]
in
add3 10
|> toString
module AlgebraicEffects exposing (..)
"workbench.colorCustomizations": {
"activityBarBadge.background": "#2979FF",
"list.activeSelectionForeground": "#2979FF",
"list.inactiveSelectionForeground": "#2979FF",
"list.highlightForeground": "#2979FF",
"scrollbarSlider.activeBackground": "#2979FF50",
"editorSuggestWidget.highlightForeground": "#2979FF",
"textLink.foreground": "#2979FF",
"progressBar.background": "#2979FF",
"pickerGroup.foreground": "#2979FF",
defmodule USPDistributorWeb.OrderController do
use USPDistributorWeb, :controller
alias USPDistributor.Orders
alias USPDistributor.Orders.Order
action_fallback USPDistributorWeb.FallbackController
plug Guardian.Permissions.Bitwise, [ensure: %{admin: [:list_orders]}] when action in [:index]
plug Guardian.Permissions.Bitwise, [ensure: %{order: [:create]}] when action in [:create]
defmodule ElchemyDeps do
def init(project, {__MODULE, _}) do
# We don't need additional elixirc paths, and elchemy paths should be
# configurable by the user (and there already is a default value)
project
|> put_in(:compilers, [:elchemy | (project[:compilers] || [])])
|> put_in(:deps, project[:deps] ++ deps())
end
def deps do
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
module Elchemy.Platoform.Eff exposing (..)
type alias IO eff =
{ getEmpty : () -> eff
, reduce : List (eff -> eff)
}
type Eff x y
module SingletonIncrementer exposing (..)
{-| Experiment on implementing type-safe OTP compliant GenServer
-}
import Platform exposing (Task(..))
import Task
import Time