Skip to content

Instantly share code, notes, and snippets.

View dugdaniels's full-sized avatar
🧠
Learning

Ðug dugdaniels

🧠
Learning
View GitHub Profile
@dugdaniels
dugdaniels / index.html
Created January 7, 2013 00:34
An example of a browser-based input for Johnny-Five. Clicking the button in index.html turns on and off an LED installed on the Arduino board.
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="/socket.io/socket.io.js"></script>
<script>
$(document).ready(function() {
var socket = io.connect('http://localhost');
$('#button').click(function(e){
socket.emit('click');
e.preventDefault();
<html>
<head>
<title>Test Suite</title>
<script>
(function() {
var queue = [], paused = false, results;
this.test = function(name, fn) {
queue.push(function() {
results = document.getElementById('results');
results = assert(true, name).appendChild(document.createElement('ul'));
function named(){
(function(){
this.foo = function() {
alert('bar');
}
})();
}
named.foo();
public static List<int> ScoreFrames(List<int> rolls) {
List<int> frameList = new List<int>();
int rollNumber = 0;
int currentFrame = 0;
int rollsRemainingInFrame = 2;
foreach (int roll in rolls) if (frameList.Count < 10) {
rollNumber++;
rollsRemainingInFrame--;
@dugdaniels
dugdaniels / MouseOrbitAndZoom.cs
Created August 3, 2016 20:59
The Unity MouseOrbit standard asset modified to include scroll wheel zooming.
using UnityEngine;
using System.Collections;
public class MouseOrbitAndZoom : MonoBehaviour {
public Transform target;
public float distance = 10f;
public float xSpeed = 250f;
public float ySpeed = 120f;
@dugdaniels
dugdaniels / Commands.cs
Created September 28, 2017 17:00
The Command pattern in Unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public interface Command {
void Execute();
}
public class Jump : Command {
string messageToLog;