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
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: [
defmodule Estate do
defmacro machine(column_name, events) do
Enum.each(events, fn ({event_name, transitions}) ->
quote do
Enum.each(unquote(transitions), fn ({from, to}) ->
def unquote(:"before_#{event_name}")(%{unquote(column_name) => from} = record) do
record
end
def unquote(:"after_#{event_name}")(%{unquote(column_name) => to} = record) do
def create(_parent, arguments, _resolution) do
%{name: name, subject_id: subject_id} = arguments
tag = Repo.insert(Tag.changeset(%Tag{}, %{name: name}))
|> case do
{:ok, tag} -> tag
{:error, _} -> Repo.one(from(tag in Tag, where: tag.name == ^name))
end
subject_model = case arguments do
{:error,
#Ecto.Changeset<
action: :update,
changes: %{},
errors: [tags: {"is invalid", [type: {:array, :map}]}],
data: #Poutineer.Models.Recipe<>,
valid?: false
>}
post
|> Repo.preload(:tags)
|> Ecto.Changeset.change()
|> Ecto.Changeset.put_assoc(:tags, [tag | post.tags])
|> Repo.update()
{
"name": "kibana.mops.example.com",
"uuid": "0cf8c51c-2fd7-4090-ac1b-eb032a19041e",
"version": {
"number": "7.4.2",
"build_hash": "d7f39418dcaf7a243158b89f84bb82f39b04e5e5",
"build_number": 26506,
"build_snapshot": false
},
"status": {