This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Pong.pde: The classic game "Pong" written in Processing | |
Author: Palmer Paul | |
Email: [email protected] | |
Twitter: @pzp1997 | |
Version: 1.0.0 (10/29/14 07:25) | |
Copyright: (c) 2014, Palmer Paul | |
*/ | |
float p1, p2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function unify(a, b) { | |
var newObj = {}; | |
var aKeys = Object.keys(a); | |
var bKeys = Object.keys(b); | |
for (var n = 0; n < aKeys.length; n++) { | |
newObj[aKeys[n]] = a[aKeys[n]]; | |
if (aKeys[n] in b) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class myClass(object): | |
def __init__(self, myInt): | |
self.myString = "Hello" | |
self.myInt = myInt | |
def foo(self): | |
self.myString = self.myString + " world." | |
def add(self, n): | |
self.myInt += n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.7 | |
from urllib2 import urlopen | |
def main(): | |
print 'Hangman.py (c) 2014, pzp1997' | |
print 'Input "exit" or "quit" to quit.' | |
while True: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Chess by Palmer Paul and Josh Verscheslieser | |
/* Piece IDs | |
Black White Piece | |
1 7 Rook | |
2 8 Knight | |
3 9 Bishop | |
4 10 Queen | |
5 11 King | |
6 12 Pawn |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>BallSensor</title> | |
</head> | |
<body> | |
<canvas id="can" height="400" width="400" style="border:1px solid #000000;"></canvas> | |
<script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Array to hold ball objects | |
Ball[] balls = new Ball[int(random(8, 18))]; | |
void setup() { | |
size(600, 600); | |
noStroke(); | |
// Creates balls with random properties | |
for (int i = 0; i < balls.length; i++) { | |
balls[i] = new Ball(random(width), random(height), int(random(80, 120)), random(1, 5), color(random(255), random(255), random(255))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* /app.js */ | |
// require() dependecies | |
var mongoose = require('mongoose'); | |
// require() router objects | |
var user = require('./routes/user'); | |
// app.use() middleware | |
var db = mongoose.connect('mongodb://test:[email protected]:47720/db_example'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gravity is simulated by increasing the downward velocity | |
// in the void draw() {} | |
float x, y, wid, ht; | |
float dy; // downward speed | |
float gravity; // strength of gravity's pull | |
float damping; // factor for how much energy the ball loses | |
// when it hits the floor | |
float upThrust; // upward force by user, if desired | |
float dx; // for left and right movement if you want |