Skip to content

Instantly share code, notes, and snippets.

View alfredbaudisch's full-sized avatar

Alfred Reinold Baudisch alfredbaudisch

View GitHub Profile
Creation of an opposite macro
We want opposite 1 + 1
to return to 0 or essentially run 1 - 1
opposite 1 + 1
Transforms 1 + 1 into an AST
opposite({:+, [], [1,1]}
Our macro would then transform that AST (Abstract syntax tree)
@msysyamamoto
msysyamamoto / lib-hello_phoenix-memcached_supervisor.ex
Created September 1, 2015 15:13
Poolboy Sample on Phoenix Framework
defmodule HelloPhoenix.Memcached.Supervisor do
use Supervisor
def start_link do
Supervisor.start_link(__MODULE__, [])
end
def init([]) do
pool_options = [
name: {:local, :memcached_pool},
@mattweldon
mattweldon / up-and-running-with-edeliver-on-do.md
Last active September 3, 2021 16:48
Getting Elixir / Phoenix running on Digital Ocean with edeliver

Build Server

  • Go to Digital Ocean
  • Create new droplet
  • London
  • Ubuntu
  • No apps
  • Add SSH keys
@sorentwo
sorentwo / start_oban_web.livemd
Created July 27, 2022 16:38
Single Page Oban Web

Single Page Oban Web

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,
@ulrikdamm
ulrikdamm / EditPrefab.cs
Last active May 10, 2023 07:44
Unity editor script for better editing of prefabs. Put in Assets/Editor.
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
// Adds a "Edit Prefab" option in the Assets menu (or right clicking an asset in the project browser).
// This opens an empty scene with your prefab where you can edit it.
// Put this script in your project as Assets/Editor/EditPrefab.cs
public class EditPrefab {
static Object getPrefab(Object selection) {
@andrew-wilkes
andrew-wilkes / circular-progress.shader
Created January 16, 2020 11:41
Circular Progress Shader in Godot Engine
shader_type canvas_item;
uniform float value: hint_range(0, 100); // %
uniform float thickness: hint_range(0, 100) = 30.; // % thickness
uniform sampler2D fg: hint_albedo;
uniform sampler2D bg: hint_black_albedo;
uniform float offset: hint_range(0, 100); // %
uniform float smoothing: hint_range(0, 100) = 5.;
void fragment() {
@wojtekpil
wojtekpil / hterrain_detail_enhanced.shader
Last active October 11, 2023 19:14
Hterrain enhanced shader for detail layers
shader_type spatial;
render_mode cull_disabled, blend_mix,diffuse_burley, specular_schlick_ggx;
uniform sampler2D u_terrain_heightmap;
uniform sampler2D u_terrain_detailmap;
uniform sampler2D u_terrain_normalmap;
uniform sampler2D u_terrain_globalmap : hint_albedo;
uniform mat4 u_terrain_inverse_transform;
uniform mat3 u_terrain_normal_basis;
@winston-yallow
winston-yallow / test.gd
Last active January 25, 2024 06:32
Godot 4.x Compute Example
extends Node
# Based on this tweet by Clay John:
# https://twitter.com/john_clayjohn/status/1306447928932753408
func _ready() -> void:
# Create a local rendering device.
var rd := RenderingServer.create_local_rendering_device()
@Makeshift
Makeshift / tutorial.md
Last active March 28, 2024 02:33
Tutorial for automatically syncing an Obsidian vault with Git on an Android device

How to sync Obsidian with Git on Android

Limitations

  • If Termux is closed in the background by Android, the cron service will stop updating your repository and you must open Termux again. Refer to instructions for your device model to disable the killing of certain background applications.
  • This may negatively affect your devices battery life. I'm not entirely sure yet.

Setup

@WolfgangSenff
WolfgangSenff / gist:168cb0cbd486c8c9cd507f232165b976
Last active April 15, 2024 22:14
Godot 4.0 Migration/Upgrade guide
## For a beginner-friendly version of the following (more advanced users likely will get better use of the below,
## if you're just starting out...), see this new gist:
## https://gist.github.com/WolfgangSenff/0a9c1d800db42a9a9441b2d0288ed0fd
This document represents the beginning of an upgrade or migration document for GDScript 2.0 and Godot 4.0. I'm focusing on 2D
at the moment as I'm upgrading a 2D game, but will hopefully have more to add for 3D afterward.
## If you want more content like this, please help fund my cat's medical bills at https://ko-fi.com/kyleszklenski - thank you very much! On to the migration guide.