Skip to content

Instantly share code, notes, and snippets.

View pbhogan's full-sized avatar

Patrick Hogan pbhogan

View GitHub Profile
#!/bin/bash
### BEGIN INIT INFO
# Provides: APPLICATION
# Required-Start: $all
# Required-Stop: $network $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the APPLICATION unicorns at boot
# Description: Enable APPLICATION at boot time.
### END INIT INFO
@t-mat
t-mat / dinput8_joystick.cpp
Created November 24, 2011 12:52
DirectInput Joystick class
#include <windows.h>
#include <stdio.h>
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#pragma comment(lib, "dinput8.lib")
#pragma comment(lib, "dxguid.lib")
class DiJoyStick {
public:
@AngryAnt
AngryAnt / EditorWindowExample.cs
Created June 15, 2012 08:30
EditorWindowExample from the Unity Asia Bootcamp 12 talk "Streamlining your Unity editor". A simple node based editor.
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
public class EditorWindowExample : EditorWindow
{
List<Node> nodes = new List<Node> ();
@hakanensari
hakanensari / benchmark.rb
Created October 3, 2012 18:47
PostgreSQL update strategies in and around Rails
require 'active_record'
require 'activerecord-import'
require 'benchmark'
require 'pg'
include ActiveRecord
Base.establish_connection adapter: 'postgresql',
encoding: 'unicode',
pool: 5,
using System;
using System.Collections.Generic;
using UnityEngine;
public class Scroller
{
public float maxDragSpeed = 20.0f; //maximum drag speed
public float edgeSquish = 60.0f; //how far to go past the end
public float edgeBounce = 0.19f; //how much force to use to bounce back
public float strongFriction = 0.75f; //used to bring it to a stop quicker
@MattRix
MattRix / DZMenu.cs
Created April 28, 2014 17:55
Unity menu item to do iOS builds easily (make sure you put it in a folder named "Editor")
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using System;
public class DZMenu
{
[MenuItem ("DiscoZoo/Build for iOS")]
static void BuildForIOS()
{
@prime31
prime31 / ParticleFlock.cs
Created May 1, 2014 17:42
Simple (unoptimized!) particle flock. Stick it on a GameObject with a ParticleSystem and play with inspector for some interesting results. Clicking anywhere on screen will set the target position for all boids.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
[RequireComponent( typeof( ParticleSystem ) )]
public class ParticleFlock : MonoBehaviour
{
public Vector3 targetPosition;
public int totalBoids = 15;
@prime31
prime31 / Vector3Editor.cs
Last active August 23, 2018 20:27
Ever get tired of creating piles of GameObjects just because you want a Vector3 position? Those days are over. The Vector3Editor will let you edit single Vector3 properties and arrays of Vector3's without having to create a plethora of GameObjects.
// Usage:
// - stick the Vector3Editor.cs file in the Editor folder of your project
// - create a class with a Vector3 or Vector3[] property (you probably already have plenty of them. The WarpZone class below is a simple example)
// - create an editor script for any the class that you want to be able to edit extending Vector3Editor (see WarpZoneEditor below)
// - in OnEnable simply call setup() with your property names and optional labels
using UnityEngine;
using UnityEditor;
@v21
v21 / Extensions.cs
Last active August 29, 2015 14:05
Unity3D new UI convienience extensions
using System.Linq;
using UnityEngine;
using System;
using System.Collections.Generic;
using Debug = UnityEngine.Debug;
using Object = UnityEngine.Object;
using Random = UnityEngine.Random;
using UnityEngine.EventSystems;
using UnityEngine.Events;
@jpsarda
jpsarda / WaveExplo.shader
Last active August 3, 2022 05:10
Unity (pro) post processing explosion wave effect (need GoKit library). You call it like this : WaveExploPostProcessing.Get().StartIt(myVector2Position);
Shader "Custom/WaveExplo" {
Properties {
_MainTex ("", 2D) = "white" {}
_CenterX ("CenterX", Range(-1,2)) = 0.5
_CenterY ("CenterY", Range(-1,2)) = 0.5
_Radius ("Radius", Range(-1,1)) = 0.2
_Amplitude ("Amplitude", Range(-10,10)) = 0.05
}
SubShader {