Skip to content

Instantly share code, notes, and snippets.

View pvanallen's full-sized avatar

Philip van Allen pvanallen

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="jquery game" />
<script src="http://code.jquery.com/jquery-latest.js"></script>
<meta charset=utf-8 />
<title>jquery game</title>
</head>
<body>
<div id="score">0</div>
@pvanallen
pvanallen / text wrapping.py
Created May 8, 2014 17:02
word wrap test
from scene import *
from random import random
class MyScene (Scene):
def setup(self):
# This will be called before the first frame is drawn.
# Set up the root layer and one other layer:
longText = "This is an example of a long text string that needs to be word wrapped and displayed as a multiline body of text. This is an example of a long text string that needs to be word wrapped and displayed as a multiline body of text."
self.root_layer = Layer(self.bounds)
@pvanallen
pvanallen / analogIn.py
Last active August 29, 2015 14:01
set the X position of a circle with the result of the analog input port 0
from scene import *
import requests
class MyScene (Scene):
def setup(self):
# This will be called before the first frame is drawn.
pass
def draw(self):
# This will be called for every frame (typically 60 times per second).
@pvanallen
pvanallen / javascriptBasics.js
Last active October 9, 2020 03:06
Series of code snippets to practice with
// viewing errors
// this line has an error in it
let myVar, = 10;
// using the console
console.log("hi");
console.log(myVar);
// variable set a value + case
// this line has an error in it
@pvanallen
pvanallen / LEDOnOff.ino
Last active September 8, 2016 01:24
Creative Tech Course: Solution to the LED Dimmer ON/OFF exercise from week
/*
Set the brightness of an LED with a potentiometer
Use a momentary switch to turn the LED on (at the brightness set by pot) or off
*/
// These constants won't change. They're used to give names
// to the pins used:
const int analogInPin = A1; // Analog input pin that the potentiometer is attached to
const int analogOutPin = 3; // Analog output pin that the LED is attached to
const int buttonPin = 2; // the number of the pushbutton pin
@pvanallen
pvanallen / LEDOnOffExtraCredit.ino
Last active September 8, 2016 01:23
Creative Tech Course: LED Dimmer ON/OFF Extra Credit - Toggle On/Off
/*
Set the brightness of an LED with a potentiometer
Use a momentary switch to toggle the LED on (at the brightness set by pot) or off
Toggle happens each time the button is pressed to the ON position
*/
// These constants won't change.
const int analogInPin = A1; // Analog input pin that the potentiometer is attached to
const int analogOutPin = 3; // Analog output pin that the LED is attached to
const int buttonPin = 2; // the number of the pushbutton pin
@pvanallen
pvanallen / ArduinoFunctionExample1.ino
Last active September 8, 2016 01:22
Creative Tech Course: Arduino Function Example 1
/*
Arduino Function Example 1 - BlinkLed1
Blinks an LED - part of a series to experiment with functions
Creative Technology Course by Philip van Allen - ArtCenter College of Design
*/
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
@pvanallen
pvanallen / ArduinoFunctionExample2.ino
Last active September 8, 2016 01:22
Creative Tech Course: Arduino Function Example 2
/*
Arduino Function Example 2 - BlinkLed2
Blinks an LED - part of a series to experiment with functions
Creative Technology Course by Philip van Allen - ArtCenter College of Design
*/
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
@pvanallen
pvanallen / ArduinoFunctionExample3.ino
Last active September 8, 2016 01:21
Creative Tech Course: Arduino Function Example 3
/*
Arduino Function Example 3 - BlinkLed3
Blinks an LED - part of a series to experiment with functions
Creative Technology Course by Philip van Allen - ArtCenter College of Design
*/
const int LED1 = 13;
const int LED2 = 5;
// the setup function runs once when you press reset or power the board
@pvanallen
pvanallen / ArduinoFunctionExample4.ino
Last active September 8, 2016 01:21
Creative Tech Course: Arduino Function Example 4
/*
Arduino Function Example 4 - Range
Gets a range from analogWrite - part of a series to experiment with functions
Creative Technology Course by Philip van Allen - ArtCenter College of Design
*/
const int sensor = A0;
int range = 0;
// the setup function runs once when you press reset or power the board