Skip to content

Instantly share code, notes, and snippets.

Avatar

Luke perky

View GitHub Profile
@perky
perky / anytype_antics.zig
Created April 29, 2023 19:34
Exploring different ways of using "anytype" in Zig for both static and runtime dispatch.
View anytype_antics.zig
//! ==============
//! Anytype Antics.
//! ==============
const std = @import("std");
const debug = std.debug;
const builtin = std.builtin;
const trait = std.meta.trait;
fn print(string: []const u8) void { debug.print("{s}\n", .{string}); }
const DONT_COMPILE = false;
@perky
perky / mario_state_machine.zig
Last active April 23, 2023 21:38
Mario State Machine. Showcases the usefulness of switches and tagged unions in Zig.
View mario_state_machine.zig
//! ======
//! file: mario_state_machine.zig
//! This is an example of a Mario/Powerup state machine.
//! It showcases the usefulness of switches and tagged unions in Zig.
//! See state machine diagram:
//! https://external-preview.redd.it/TgwKB-bdEWJase06sIDXmVtaGaP7AZTD9YKn0x4yUWo.png?auto=webp&s=c0318b178038bd83212392c8fdd16e1a4b1a0049
//! ======
/// This is a tagged union.
/// See tagged union doc:
@perky
perky / BindComponentAttribute.cs
Created April 16, 2019 12:31
A little script for Unity that helps binding references to other components in the scene.
View BindComponentAttribute.cs
using UnityEngine;
using System.Linq;
using System;
using System.Reflection;
public class BindComponent : PropertyAttribute
{
public enum FindMode
{
InSelf, // Find the component on the calling GameObject.
View LobbyMenu.cs
using UnityEngine;
using Bolt;
public class LobbyMenu : GlobalEventListener
{
[SerializeField] string _gameplayScene;
[SerializeField] ushort _port = 27000;
[SerializeField] ushort _broadcastPort = 27001;
bool _bClientLANInit;
View gist:873e01daf635007870ee3535d862cee7

Useful Unreal Engine Stuff

Commands

command description
FREEZERENDERING This commands freezes the culling state and lets you fly around to see what is actually being rendered.
stat initviews stats relevant to culling.

Marketplace

https://www.unrealengine.com/marketplace/instance-tool

@perky
perky / BTF Winner
Created September 1, 2014 17:05
Beat the Frog Emails.
View BTF Winner
<p>
Hi <%= @user.stage_name %>,
</p>
<p>
Congratulations, you beat the frog on <%= @event_date %> at Frog and Bucket <%= @event_city %>. So what's next? You can now book a couple of 8 minute spots, that's 8 uninterrupted minutes on stage at the start of the show. To book simply login to the Beat The Frog website and you'll see a new button appear to book an 8 spot. <%= link_to "Book now", root_url %>.
</p>
<p>
<a href="<%= @event_url %>">Link to event.</a>
</p>
<p>
View gist:6041837
import processing.video.*;
import oscP5.*;
class Preset
{
public void activate(PImage src, PImage dst) {}
}
Capture video;
//Movie video;
View gist:4420971
RewriteEngine on
RewriteRule ^lukeperkin$ lukeperkin.html
@perky
perky / MindCrack pack + MineChem
Last active December 10, 2015 10:09
OreDictionary Names: Direworlf20 pack + MineChem
View MindCrack pack + MineChem
100kEUStore
10kCoolantStore
10kEUStore
10kkEUPack
10kkEUStore
180kCoolantStore
1kkEUStore
300kEUPack
30kCoolantStore
360kCoolantStore
@perky
perky / gist:4413516
Last active March 16, 2019 22:18
Caused by: java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.remove(Unknown Source) Line 9: potionKey.remove();
View gist:4413516
private void cureAllPotions(World world, EntityPlayer entityPlayer) {
List<PotionEffect> activePotions = new ArrayList(entityPlayer.getActivePotionEffects());
for(PotionEffect potionEffect : activePotions) {
entityPlayer.removePotionEffect(potionEffect.getPotionID());
}
}