Skip to content

Instantly share code, notes, and snippets.

View phoenixperry's full-sized avatar

Phoenix Perry phoenixperry

View GitHub Profile
@phoenixperry
phoenixperry / IDsandClasses
Created February 3, 2012 19:19
ID vs Classes
<div id="navmenu">
<ul>
<li class="page_item page-item-16"><a href="http://learn.areyoudevoted.com/?page_id=16">home</a></li>
<li class="page_item page-item-6"><a href="http://learn.areyoudevoted.com/?page_id=6">teachers</a></li>
<li class="page_item page-item-88"><a href="http://learn.areyoudevoted.com/?page_id=88">classes</a></li>
<li class="page_item page-item-1078"><a href="http://learn.areyoudevoted.com/?page_id=1078">programs</a></li>
@phoenixperry
phoenixperry / classesIDs
Created February 3, 2012 19:23
classes vs Ids
<div id="navmenu">
<ul>
<li class="page_item page-item-16"><a href="http://learn.areyoudevoted.com/?page_id=16">home</a></li>
<li class="page_item page-item-6"><a href="http://learn.areyoudevoted.com/?page_id=6">teachers</a></li>
<li class="page_item page-item-88"><a href="http://learn.areyoudevoted.com/?page_id=88">classes</a></li>
<li class="page_item page-item-1078"><a href="http://learn.areyoudevoted.com/?page_id=1078">programs</a></li>
@phoenixperry
phoenixperry / gist:6888925
Created October 8, 2013 18:09
Example of OnCollisionEnter in Unity in c# from Unity 3d Student
void OnCollisionEnter(Collision theCollision){
if(theCollision.gameObject.name == "Floor"){
Debug.Log("Hit the floor");
}else if(theCollision.gameObject.name == "Wall"){
Debug.Log("Hit the wall");
}
void OnCollisionEnter(Collision theCollision){
if(theCollision.gameObject.name == "Floor"){
Debug.Log("Hit the floor");
}else if(theCollision.gameObject.name == "Wall"){
Debug.Log("Hit the wall");
}
}
@phoenixperry
phoenixperry / gist:6889013
Last active December 25, 2015 00:39
Unity c# example of OnTriggerEnter
void OnTriggerEnter (Collider myTrigger) {
if(myTrigger.gameObject.name == "box"){
Debug.Log("Box went through!");
}
}
@phoenixperry
phoenixperry / gist:6889430
Last active December 15, 2019 09:15
Unity c# example of Raycast
using UnityEngine;
using System.Collections;
public class RayCastExample : MonoBehaviour {
// Use this for initialization
void Start () {
}
@phoenixperry
phoenixperry / gist:6889578
Created October 8, 2013 18:48
unity c# GUI Texture
public Texture2D normalTex;
public Texture2D hoverTex;
void OnMouseEnter () {
guiTexture.texture = hoverTex;
}
void OnMouseExit(){
guiTexture.texture = normalTex;
public int Counter = 0;
void Update () {
Counter++;
guiText.text = "Counter is: "+Counter;
}
@phoenixperry
phoenixperry / gist:6890135
Last active December 25, 2015 00:49
This is an example of abstract classes, interfaces and polymorphism
/* Polymoprhism allows for objects to be dynamically switched on runtime because
each object extending the root type Pet can be used interchangably. You can think of polymorphism as allowing each object to share a type and a set of functions but to be able ot switch for each other in code based on what you need.
You know every object extending that root object will implement all methods marked abstract and be able touse all methods that are defined. The Abstract functionality gets you around having to instantiate the abstract object.
*/
Cat cat;
Dog dog;
Pet currentPet;
int counter = 0;
void setup(){
var inputs = document.getElementsByTagName('input');
for(var i=0; i < inputs.length; i++) {
if(inputs[i].type == 'checkbox') {
if(inputs[i].disabled == false){inputs[i].click()};
}
}