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 / setOnClickListener.java
Last active November 26, 2017 10:09
setOnClickListener (Android/Java)
Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// do stuff
}
});
@topherPedersen
topherPedersen / intent.java
Created November 26, 2017 10:46
Create Intent, Start Activity (Android/Java)
Intent i = new Intent(this, NewActivity.class);
i.putExtra(EXTRA_FOO, "bar");
startActivity(i);
@topherPedersen
topherPedersen / get.js
Created December 26, 2017 22:34 — forked from rafaelstz/get.js
AJAX GET and POST with pure Javascript
// Exemplo de requisição GET
var ajax = new XMLHttpRequest();
// Seta tipo de requisição e URL com os parâmetros
ajax.open("GET", "minha-url-api.com/?name=Henry&lastname=Ford", true);
// Envia a requisição
ajax.send();
// Cria um evento para receber o retorno.
@topherPedersen
topherPedersen / Magic8Ball.swift
Last active July 17, 2018 00:53
Magic 8 Ball Tutorial in Swift
// NOTE: This Magic 8 Ball Tutorial in Swift is for my personal reference
// teaching students at theCoderSchool in Flower Mound, TX
// This isn't a full blown application, just two swift files
// combined into one github gist for reference when assisting
// students with their "Magic 8 Ball" assignment. This app consists
// of one view containing a label, a text field, and a button.
// Users enter their question into the text field and then press
// the button to submit their question. The app then answers the user
// using a simple UIAlertController (alert/dialog popup). Students
// need to connect the button from their main storyboard to the
@topherPedersen
topherPedersen / NewSpriteKitProject.swift
Created July 8, 2018 22:42
App Team Lesson 1: Create New Sprite Kit Project, Replace Boilerplate Code, Add Background and Player Sprites
// This gist includes the two main files from a SpriteKit app for iOS and is for my personal reference
// teaching my app team students how to create 2D games for iOS using SpriteKit
//
// GameScene.swift
// HelloSpriteKit
//
// Created by Christopher Pedersen on 7/8/18.
// Copyright © 2018 Christopher Pedersen. All rights reserved.
//
@topherPedersen
topherPedersen / VerticalSceneScrolling.swift
Created July 17, 2018 00:51
Vertical Scene Scrolling in SpriteKit (using multiple images)
// This gist is comprised of two swift files which demonstrate how to do
// vertical scene scrolling with SpriteKit using two images. This code
// is based on the example app from 'Beginning Swift Games Development for iOS'
// by James Goodwill and Wesley Matlock. In Goodwill's example app from the
// book, SuperSpaceMan, the app uses a single background image for scene
// scrolling, and scrolling is limited to the size of the single background.
// I was interested in achieving the same effect using multiple images to
// allow for further scrolling, so I've gone ahead and modified Goodwill's
// app and posted it here for my own personal reference. Specifically, this
// code is being posted for use in my app team class at theCoderSchool in
@topherPedersen
topherPedersen / Magic8BallCommandLine.swift
Created July 17, 2018 03:05
Command-Line Version of Magic 8 Ball written in Swift
import Foundation
print("Welcome to Magic 8 Ball!")
var keepPlaying = true
while keepPlaying == true {
// Prompt user to ask Magic 8 Ball a question
print("What is your question? ")
// We use the variable name '_' underbar below instead of something more
@topherPedersen
topherPedersen / simplepong.py
Created July 17, 2018 17:09
SImple Pong by Peter Kwak
# Simple Pong by Peter Kwak
# Developed as a tutorial for students theCoderSchool in Flower Mound, TX
# https://imgur.com/a/5uN2r5L
# https://imgur.com/a/FOCWN7R
@topherPedersen
topherPedersen / simpleObject.py
Created July 18, 2018 15:21
Simple Object Creation in Python
# This sample code is for reference teaching students Python at theCoderSchool in Flower Mound, TX
class Student:
def __init__(self, name, gradeLevel, average):
self.name = name
self.gradeLevel = gradeLevel
self.average = average
chris = Student("Chris", 12, 88)
@topherPedersen
topherPedersen / turtleInSpace.py
Created July 18, 2018 19:12
How to create add a background, create a player sprite, and add game controller functionality in Python using Turtle Graphics
# This code was written by the team at www.trinket.io for use in their trinket.io
# web based integrated python development environment. The game may need some
# modification to work using the standard Python 2.7 distribution. This code
# has been posted here to my personal github profile for reference purposes
# related to my teaching duties at theCoderSchool in Flower Mound, TX.
# This code is from the public domain, is free to use and modify, and does
# not require a software license of any kind.
# Click in the righthand window to make it active then use your arrow
# keys to control the spaceship!