Skip to content

Instantly share code, notes, and snippets.

View Mr-Coxall's full-sized avatar

Patrick Coxall Mr-Coxall

  • St. Mother Teresa HS
  • Ottawa
View GitHub Profile
# getting the Ottawa weather forcast into a dictionary
import requests
weather_forcast = {}
response = requests.get('https://weather.gc.ca/wxlink/site_js/s0000623_e.js').text
weather_output = response.splitlines()
print("Got weather")
-----------------------------------------------------------------------------------------
--
-- main.lua
--
-----------------------------------------------------------------------------------------
-- Jump
local physics = require( "physics" )
-----------------------------------------------------------------------------------------
--
-- main.lua
--
-----------------------------------------------------------------------------------------
-- Gravity
local physics = require( "physics" )
-----------------------------------------------------------------------------------------
--
-- main.lua
--
-----------------------------------------------------------------------------------------
-- Character move
local dPad = display.newImage( "./assets/sprites/d-pad.png" )
dPad.x = 150
-- Comprehensive touch code
local theBall = display.newImage( "./assets/sprites/ball.png" )
theBall.x = display.contentCenterX
theBall.y = display.contentCenterY
theBall.id = "ball object"
function theBall:touch( event )
if ( event.phase == "began" ) then
print( "Touch event began on: " .. self.id )
-- simple touch code
local theBall = display.newImage( "./assets/sprites/ball.png" )
theBall.x = display.contentCenterX
theBall.y = display.contentCenterY
theBall.id = "ball object"
local function onBallTouched( event )
if ( event.phase == "began" ) then
print( "Touch event began on: " .. event.target.id )
@Mr-Coxall
Mr-Coxall / index.html
Created March 18, 2018 21:24 — forked from nuta/index.html
CP2102 (used by ESP32-DevKitC) WebUSB device driver
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>esptool.js</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xterm/2.9.2/xterm.min.js" integrity="sha256-8rsVcpCnO6HdeJL84i0VdubjM42fjSmO8aONghdq3gc=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/xterm/2.9.2/xterm.min.css" integrity="sha256-w69o8Y6P5VZjfYFmn2KlqMU7TUi2I+oWObi8FLlVZZg=" crossorigin="anonymous" />
</head>
-----------------------------------------------------------------------------------------
--
-- command line Lua
--
-- show how to use an if statement
-- and random numbers
--
-----------------------------------------------------------------------------------------
math.randomseed( os.time() )
@Mr-Coxall
Mr-Coxall / ESP - wifi.ino
Created February 27, 2018 16:24
Wifi connection sketch
/*
* Created by: Mr. Coxall
* Created on: Feb 2018
*
** Connect the ESP8266 unit to an existing WiFi access point
** For more information see http://42bots.com
*
* Updated by Mr. Coxall to connect to school network
*/
@Mr-Coxall
Mr-Coxall / ESP8266_-_Blink.ino
Created February 26, 2018 20:16
ESP8266 - Blink Sketch