Application.put_env(:sample, Sample.Repo, database: "oban_dev")
Application.put_env(:phoenix, :json_library, Jason)
Application.put_env(:sample, Sample.Endpoint,
http: [ip: {127, 0, 0, 1}, port: 5001],
server: true,
A metatable in Lua defines various extraneous behaviors for a table when indexed, modified, interacted with, etc. They are Lua's core metaprogramming feature; most well known for being useful to emulate classes much like an OOP language.
Any table (and userdata) may be assigned a metatable. You can define a metatable for a table as such:
-- Our sample table
local tab = {}
-- Our metatable
local metatable = {
-- This table is then what holds the metamethods or metafields- @idlehands: I don't post new things
- @idlehahands@mastodon.social: if I post new things, it's here
- help@testingelixir.com: I like to help people
- Testing Elixir Book: the sample code is downloadable without buying the book
| #!/usr/bin/awk -f | |
| # This program is a copy of guff, a plot device. https://github.com/silentbicycle/guff | |
| # My copy here is written in awk instead of C, has no compelling benefit. | |
| # Public domain. @thingskatedid | |
| # Run as awk -v x=xyz ... or env variables for stuff? | |
| # Assumptions: the data is evenly spaced along the x-axis | |
| # TODO: moving average |
- macOS 10.15.5
- tmux 3.1b
macOS has ncurses version 5.7 which does not ship the terminfo description for tmux. There're two ways that can help you to solve this problem.
Instead of tmux-256color, use screen-256color which comes with system. Place this command into ~/.tmux.conf or ~/.config/tmux/tmux.conf(for version 3.1 and later):
| <body> | |
| <div id="⚛️"></div> | |
| <script src="https://unpkg.com/react@16.0.0/umd/react.development.js"></script> | |
| <script src="https://unpkg.com/react-dom@16.0.0/umd/react-dom.development.js"></script> | |
| <script src="https://unpkg.com/babel-standalone@6.26.0/babel.js"></script> | |
| <script type="text/babel"> | |
| ReactDOM.render(<div>Hello World!</div>, document.getElementById('⚛️')) | |
| </script> | |
| </body> |
A tiny (265 byte) utility to create state machine components using two pure functions.
The API is a single function that accepts 2 pure functions as arguments:
| defmodule Benchmarker do | |
| def run(title, module, function, size \\ 1024, iterations \\ 100) do | |
| times = for (_ <- 1 .. iterations) do | |
| data = :crypto.strong_rand_bytes(size) | |
| {duration, _value} = :timer.tc fn -> | |
| apply(module, function, [data]) | |
| end | |
| duration | |
| end | |
| #!/bin/sh | |
| # BSD 3-Clause License | |
| # | |
| # Copyright (c) 2017, Péter Szakszon | |
| # All rights reserved. | |
| # | |
| # Redistribution and use in source and binary forms, with or without | |
| # modification, are permitted provided that the following conditions are met: | |
| # |