Skip to content

Instantly share code, notes, and snippets.

View krainboltgreene's full-sized avatar
🏠
Working from home

Kurtis Rainbolt-Greene krainboltgreene

🏠
Working from home
View GitHub Profile
defmodule Example do
defmacro example(block) do
quote do
def test(unquote(block)) do
IO.inspect(a)
end
end
end
end

Dapper-Dan

Dapper Dan aims to be a very simple block DSL in Ruby for writing HTML documents. Instead of using alien syntaxes or dealing with embedded HTML, Dapper Dan lets you do what you know: Ruby. HTML tags are Ruby methods, tag elements are passed Ruby Hashes, and children are in blocks. Dapper Dan also provides some useful substitutions for the regular tag names, and fun little features.

Examples

defmodule LiveDataImport.ESI do
require Logger
@default_host URI.parse("https://esi.evetech.net/")
@default_fetch_query %{datasource: "tranquility"}
@type allowed_verbs :: :get | :patch | :post | :put
@spec read(String.t(), map) :: Flow.t()
def read(resource, query \\ %{datasource: "tranquility"})
def unload_cache_attempt({:ignore, :retry}, resource, parameters, http_client, cache) do
Logger.warn("Retrying request in 1s")
Process.sleep(1000)
fetch_for(resource, parameters, http_client, cache)
end
def unload_cache_attempt({:ok, %{status_code: 502}}, resource, parameters, http_client, cache) do
Logger.warn("Retrying request in 1s")
Process.sleep(1000)
fetch_for(resource, parameters, http_client, cache)
defmodule A do
# What you can write in Elixir
@spec a(String.t()) :: integer
def a(b) when is_bitstring(b) do
if b == "hello" do
1
else
2
end
end
Unit Stat Fixes: Corrects the skills of many units along with gear
https://www.nexusmods.com/mountandblade2bannerlord/mods/73
Fast Dialogue: When fighting looters or talking to lords, you'll be hit with the simpel dialog window BEFORE loading into the first person screen
https://www.nexusmods.com/mountandblade2bannerlord/mods/68
BannerPeasants: 1 in 10 soldiers will be carrying a big ass banner on their back
https://www.nexusmods.com/mountandblade2bannerlord/mods/418?tab=files&file_id=2113&nmm=1
#!/usr/bin/env ruby
require "json"
host = ARGV[0]
service = ARGV[1] || ARGV[0]
nodes = JSON.parse(`bin/terraform-nodes | jq '[.[] | [.hostname, .ip]]'`)
groups = nodes.
# [['a-b-c-d-e', '1.1.1.1']]
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
defmodule Poutineer.Models.Account do
# ...
import Estate, only: [machine: 1]
# ...
machine([
onboarding_state: [complete: [converted: "completed"]],
role_state: [
grant_moderation_powers: [user: "moderator"],
grant_administrator_powers: [user: "administrator", moderator: "administrator"]
defmodule Amodel do
use Ecto.Schema
import Estate, only: [machine: 1]
machine([
onboarding_state: [
complete: [converted: "completed"]
],
role_state: [