Skip to content

Instantly share code, notes, and snippets.

View Problematic's full-sized avatar

Derek Stobbe Problematic

View GitHub Profile
@Problematic
Problematic / sap_nearest.lua
Created November 18, 2014 23:41
WoW PvP Rogue Macros
#showtooltip Sap
/console SET targetNearestDistance 10
/targetenemy [noharm]
/console SET targetNearestDistance 41
/cast Sap
@Problematic
Problematic / LitParticle.shader
Created December 2, 2016 23:01
Standard-lit particle shader for Unity3D
Shader "Custom/Lit Particle" {
Properties {
_TintColor ("Tint Color", Color) = (1,1,1,1)
_MainTex ("Particle Texture", 2D) = "white" {}
}
SubShader {
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
LOD 200
CGPROGRAM
@Problematic
Problematic / useAnimationFrame.ts
Created November 25, 2020 20:14
React useAnimationFrame hook
import { useRef, useEffect, useCallback } from 'react'
const useAnimationFrame = (
tick: (dt: number, elapsed: number, frame: number) => void
) => {
const tickRef = useRef(tick)
const requestRef = useRef(0)
const prevTimeRef = useRef(0)
const elapsedRef = useRef(0)
const frameRef = useRef(0)
import React, { useState, useMemo, useContext } from 'react';
interface ToggleState {
items: any[];
toggleItem: (item: any, toggled?: boolean) => boolean;
}
const ToggleContext = React.createContext<ToggleState>({
items: [],
toggleItem: () => false,
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(menuName = "Problematic/Query Helper")]
public class QueryHelper : ScriptableObject
{
[SerializeField]
protected float maxDistance = Mathf.Infinity;
[SerializeField]
@Problematic
Problematic / LSystemGenerator.cs
Last active March 21, 2018 17:51
L-System Generator
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public interface ILSystemGenerator {
string Generate (string axiom, int depth);
void Clear();
}
@Problematic
Problematic / PoissonDiscSampler.cs
Last active March 14, 2018 21:05
Poisson Disc Sampling for Unity3D
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Problematic.Toolkit {
// https://www.cs.ubc.ca/~rbridson/docs/bridson-siggraph07-poissondisk.pdf
public static class PoissonDiscSampler {
const int SAMPLE_LIMIT = 30;
public static IEnumerable<Vector2> Sample<T> (QuadTree<T> quadTree, float minSeparation, System.Func<Vector2, T> CreateSample, System.Func<Vector2, QuadTree<T>, float, bool> IsCandidateValid) where T : IQuadTreeObject{
@Problematic
Problematic / StateHistory.cs
Created January 24, 2018 16:09
StateHistory.cs
using System;
using System.Collections.Concurrent;
using UnityEngine;
public class StateHistory<T> where T : IState<T> {
protected T[] buffer;
public int Head { get; protected set; }
public int Tail {
get {
if (Count < buffer.Length) {
@Problematic
Problematic / SocialBase.php
Created May 20, 2011 23:05
Working example of Symfony2 entities with Class Table Inheritance
<?php
namespace UP\SocialBundle\Entity;
/**
* UP\SocialBundle\Entity\SocialBase
* @orm:Entity
* @orm:HasLifecycleCallbacks
* @orm:InheritanceType("JOINED")
* @orm:DiscriminatorColumn(name="class_name", type="string")
@Problematic
Problematic / gulpfile.js
Last active May 28, 2017 16:29
Using Babel and Browserify with gulp
var gulp = require('gulp');
var browserify = require('browserify');
var through2 = require('through2');
gulp.task('build', function () {
return gulp.src('./src/main.js')
.pipe(through2.obj(function (file, enc, next) {
browserify(file.path, { debug: process.env.NODE_ENV === 'development' })
.transform(require('babelify'))
.bundle(function (err, res) {