Skip to content

Instantly share code, notes, and snippets.

View topherPedersen's full-sized avatar
💭
Rolling my katamari ball

Christopher Pedersen topherPedersen

💭
Rolling my katamari ball
View GitHub Profile
@topherPedersen
topherPedersen / BabylonJSDemo.html
Last active July 25, 2018 18:29
Babylon.JS Demo (Create a player sprite and empty landscape. Includes game controls to move player sprite)
<!DOCTYPE html>
<!--
Babylon.js Demo by Peter Kwak and Christopher Pedersen at theCoderSchool
in Flower Mound, TX for use teaching our introductory programming students.
This tutorial was created to demonstrate how our students favorite game,
www.ShellShock.io was created using JavaScript and the Babylon.js library.
This is free and unencumbered software released into the public domain.
For more information, please refer to <http://unlicense.org/>
-->
@topherPedersen
topherPedersen / SuperSimpleMagic8Ball.py
Last active August 29, 2018 21:11
Super Simple Magic 8 Ball
# Super Simple Magic 8 Ball
# https://bit.ly/2LGEDnh
# Greet User
print("Welcome to Magic 8 Ball!")
# Prompt User to Ask a Question
question = raw_input("What is your question?")
# Generate Random Number
@topherPedersen
topherPedersen / tictactoe.py
Last active July 28, 2018 03:21
Tic Tac Toe by Snigdha Chalapalli, a rockstar programming student at theCoderSchool in Flower Mound, TX
# Tic Tac Toe by Snigdha Chalapalli, a rockstar programming student at
# theCoderSchool in Flower Mound, TX <https://thecoderschool.com>
# This is free and unencumbered software released into the public domain.
# For more information, please refer to <http://unlicense.org/>
# TODO: Need to add code that detects when a game ends in a tie/draw.
from time import sleep
import random
@topherPedersen
topherPedersen / BasicNetworking.swift
Last active August 5, 2018 22:11
Basic Networking in Swift/iOS (Simple HTTP GET Request)
// This gist is comprised of two files demonstrating how to do simple networking
// in swift using the HTTP GET method. The first file is ViewController.swift,
// and the other is Info.plist. The Info.plist was added to this gist because
// it must be modified in order to use HTTP instead of the more secure HTTPS.
//
@topherPedersen
topherPedersen / DismissKeyboard.swift
Created August 5, 2018 03:35
How to Dismiss Keyboard in iOS
// Dismiss Keyboard
// Drag 'Tap Gesture Recognizer' from Object Library onto Background.
// Control-Drag from 'Tap Gesture Recognizer' to ViewController.swift
// to add dismissKeyboard() @IBAction. Call .resignFirstResponder()
// method from within the dismissKeyboard function to then dismiss
// the keyboard.
@IBAction func dismissKeyboard(_ sender: UITapGestureRecognizer) {
textField.resignFirstResponder()
}
@topherPedersen
topherPedersen / SingletonPatternMVC.swift
Last active August 7, 2018 07:16
Implementing an MVC Architecture in iOS using a Singleton Pattern (written in Swift)
// ------------------------------------------------------------------------------------->
// This example is comprised of three swift files demonstrating how to implement an MVC
// architecture using the singleton pattern in iOS. By using a singleton pattern one can
// create a simple class (or classes) to serve as the model for an application
// and ensure that only one instance of that class is created and that it is accessible
// globally. We do this by creating a 'shared' property to make access to the single
// instance global, and initialize the class privately to ensure that only one instance
// is ever created. While creating this simple app/gist I used the following blog post
// from Bart Jacobs at cocoacasts.com for guidance (Thanks Bart!):
//
@topherPedersen
topherPedersen / NavigateProgrammatically.swift
Created August 9, 2018 04:07
Navigate Programmatically to a New ViewController in iOS (Swift)
// This gist is comprised of two swift files, ViewController.swift and NewViewController.swift.
// The example below demonstrates how to programmatically navigate to a new ViewController
// in iOS by calling the self.present() method. While creating this gist I consulted the
// following StackOverflow forum post: https://stackoverflow.com/questions/39450124/swift-programmatically-navigate-to-another-view-controller-scene
// Lines 35 - 38 were taken directly from the previously mentioned forum post, which is in the public domain.
//
@topherPedersen
topherPedersen / MultiViewMVC.swift
Created August 9, 2018 04:39
How to build a multi-view application in iOS with Swift using a simple MVC architecture
// This gist demonstrates how to build a multi-view application in iOS
// with Swift using a simple MVC architecture. The application is comprised
// of three main files: Model.swift, ViewController.swift, and NewViewController.swift.
// The application allows a user to click a button which then programmatically
// changes a value in our model and then presents a new view. The first view
// displays the initial state of the value in our model, and the new view
// displays the updated value of the model. While building this app I
// consulted 1 blog post regarding how to implement an MVC architecture
// in iOS using a singleton pattern, and also consulted a forum post from
// the programming forum StackOverflow.com. (Both resources are in the public domain)
@topherPedersen
topherPedersen / rockscissorspaper.bas
Created August 11, 2018 17:42
Rock, Scissors, Paper
10 PRINT TAB(21);"GAME OF ROCK, SCISSORS, PAPER"
20 PRINT TAB(15);"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
25 PRINT:PRINT:PRINT
30 INPUT "HOW MANY GAMES";Q
40 IF Q<11 THEN 60
50 PRINT "SORRY, BUT WE AREN'T ALLOWED TO PLAY THAT MANY.": GOTO 30
60 FOR G=1 TO Q
70 PRINT: PRINT "GAME NUMBER";G
80 X=INT(RND(1)*3+1)
90 PRINT "3=ROCK...2=SCISSORS...1=PAPER"
@topherPedersen
topherPedersen / RockScissorsPaper.swift
Last active August 11, 2018 20:10
Rock, Scissors, Paper (Swift Edition by Shruthi)
// (WORK IN PROGRESS)
// Rock, Scissors, Paper by Shruthik-- a rockstar
// programming student at theCoderSchool in Flower Mound, TX
import Foundation
print(" GAME OF ROCK, SCISSORS, PAPER")
print(" CREATIVE COMPUTING MORRISTOWN, NEW JERSEY")
print(" ")
print(" ")
print("HOW MANY GAMES")