Skip to content

Instantly share code, notes, and snippets.

import os, cmd, sys, re, glob, os.path, shutil, zipfile, tarfile, gzip
# Credits
#
# The python code here was written by pudquick@github
#
# License
#
# This code is released under a standard MIT license.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
# software to the public domain. We make this dedication for the benefit
-- Copyright Matthew Murdoch
-- Remix under the terms of the MIT license (see http://opensource.org/licenses/MIT)
bounds = nil
circles = {}
function setup()
displayMode(FULLSCREEN)
physics.gravity(0, 0)
addBounds()
@mmurdoch
mmurdoch / Circle Bounce.lua
Last active December 20, 2015 12:39
Circle Bounce
-- Copyright Matthew Murdoch
-- Remix under the terms of the MIT license (see http://opensource.org/licenses/MIT)
Point = class()
function Point:init(x, y)
self._x = x
self._y = y
end
@mmurdoch
mmurdoch / Circle Bounce.py
Last active December 20, 2015 11:48
Circle Bounce
# Copyright Matthew Murdoch
# Remix under the terms of the MIT license (see http://opensource.org/licenses/MIT)
from random import *
from scene import *
class Rectangle(object):
def __init__(self, bottom_left, size):
self._rect = Rect(bottom_left.x, bottom_left.y, size.w, size.h)
self._fill_color = Color(0, 0, 0)
@mmurdoch
mmurdoch / Circle Move.py
Created July 29, 2013 07:48
Circle Move
from random import *
from scene import *
class Velocity(object):
def __init__(self, dx, dy):
self.dx = dx
self.dy = dy
class Circle(object):
def __init__(self, location, color, velocity):
@mmurdoch
mmurdoch / Circle Touch.py
Last active December 20, 2015 07:49
Circle Touch
# Copyright Matthew Murdoch
# Remix under the terms of the MIT license (see http://opensource.org/licenses/MIT)
from random import random
from scene import *
class Circle(object):
def __init__(self, location, color):
self.location = location
self.color = color
@mmurdoch
mmurdoch / Github Example.py
Created November 10, 2012 15:08
Example of using github library for Pythonista.
import console
import keychain
import traceback
from github import Github
def printRepository(username):
g = Github(username, getGithubPassword(username))
user = g.get_user()
repositories = user.get_repos()
@mmurdoch
mmurdoch / Get dateutil.py
Created November 6, 2012 18:18
Get dateutil
import os
import urllib2
import tarfile
import shutil
workingPath = os.getcwd()
tempPath = os.path.join(workingPath, 'temp')
dateutilArchiveDir = 'python-dateutil-1.5'
dateutilArchive = dateutilArchiveDir + '.tar.gz'
dateutilArchivePath = os.path.join(tempPath, dateutilArchive)
@mmurdoch
mmurdoch / Get Github Library.py
Last active April 29, 2023 19:45
Download github library for Pythonista.
# Note that this script attempts to delete directories (Folders) called 'temp' and 'dateutil'
# within Pythonista as part of installation. It will also overwrite files in directories
# named 'github' and 'githubista'. If you are using Pythonista 1.3 or above please check
# that you have not created any Folders with these names before running this script as
# any files inside them will be irretrievably lost.
import os
import urllib2
import tarfile
import shutil
import traceback