Skip to content

Instantly share code, notes, and snippets.

View macloo's full-sized avatar
💭
Teaching some Python

Mindy McAdams macloo

💭
Teaching some Python
View GitHub Profile
@macloo
macloo / alien_while_loop.py
Created February 2, 2014 22:35
Example of a while loop for beginners. Also an if-statement to help them figure things out.
# alien example - if-elif-else, and while loop
from random import randint # allows you to generate a random number
# variables for the alien
alive = True
stamina = 10
# this function runs each time you attack the alien
def report(s):
@macloo
macloo / test0209.py
Created February 10, 2014 03:07
Test for Alex
stuff = "Alex Randy Mandy"
other = "Jack Fletcher Isaac Bobby Susie Joey Manny Moe Jack"
apples = stuff.split(' ')
salad = other.split(' ')
basket = len(apples)
print basket
@macloo
macloo / app.html
Created December 11, 2015 03:44
Attempt to get Bootstrap table controls to work with Tabletop.js - failed
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>PointRider</title>
<!-- Bootstrap -->
<!-- changed order so table comes after Bootstrap -->
<link href="bootstrap3/css/bootstrap.css" rel="stylesheet">
@macloo
macloo / radiobuttons 1
Created December 11, 2015 19:19
Get value of radio button set
var radioButtons = document.getElementsByName("taste");
for ( var i in radioButtons ) {
if ( radioButtons[i].checked ) {
var checkedButton = radioButtons[i].value;
break;
}
}
if (checkedButton == "salty") {
@macloo
macloo / lightbox.html
Created December 12, 2015 00:49
Simple lightbox - all code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Simple Lightbox</title>
<style>
/* overlay dims screen for simple lightbox */
@macloo
macloo / index.html
Last active December 16, 2015 02:38
A CodePen by Mindy McAdams. Simple Horizontal Nav - Buttons in a row, suitable for top navigation on a website
<!-- Simple navigation button set
Not responsive
Aligns to right -->
<div id="nav">
<ul>
<li><a href="#">Home</a></li>
<li id="inactive-link">About</li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">Websites</a></li>
@macloo
macloo / index.html
Created April 11, 2013 14:52
A CodePen by Mindy McAdams. Canvas and setInterval - Create a grid of squares that all change color endlessly, on a 500ms timer.
<canvas id="myCanvas" width="600" height="320">
<p>Some default content can appear here.</p>
</canvas>
@macloo
macloo / index.html
Last active December 16, 2015 02:39
A CodePen by Mindy McAdams. Canvas techniques - Mark points on a grid - write text on the canvas - get familiar with the coordinates.
<p>Using the canvas to understand the canvas:</p>
<canvas id="myCanvas" width="601" height="401">
<p>Some default content can appear here.</p>
</canvas>
# Put this in the root directory of your repository in a file called
# "Makefile". When you're ready to re/publish, just open terminal, cd
# to the directory containing your repo and type "make publish". As
# you can see, it's just a bunch of commands so you can easily add
# more steps to this workflow. Idea by Jeff Larson
publish:
git checkout gh-pages
git merge master
git push origin gh-pages
@macloo
macloo / ftponefile.py
Last active December 16, 2015 14:08
Python FTP script for uploading a single file
import ftplib
session = ftplib.FTP('HOSTNAME','USERNAME','PASSWORD')
session.cwd('//DIR//DIR//DIR//')
f = open('Downloads/picture.jpg', 'r')
session.storbinary('STOR pic2.jpg', f)
f.close()
session.quit()
# http://www.pythonforbeginners.com/code-snippets-source-code/how-to-use-ftp-in-python/