This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ui | |
from random import randint | |
import console | |
import clipboard | |
# Generate some random hex colors: | |
colors = ['#%X%X%X' % (randint(0,255), randint(0,255), randint(0,255)) for i in xrange(25)] | |
def tapped(sender): | |
r, g, b, a = sender.background_color | |
hex_color = '#%X%X%X' % (int(r*255), int(g*255), int(b*255)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
# Starting point for emailing a group of people via Dispatch... | |
# The people in the group are identified by a unique string in the Notes field. | |
# TODO: Support setting the group identifier with an argument when launching the script via URL scheme (LCP...) - subject, body etc. could also be passed as arguments. | |
# Change this: | |
group_note = 'Group1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Minimal example for ui.Image.clip_to_mask | |
# Note: Due to the changed image names, this requires Pythonista 1.6 (beta), but it could work in 1.5bwith different image names. | |
import ui | |
with ui.ImageContext(256, 256) as ctx: | |
mask_img = ui.Image.named('iow:beaker_256') | |
img = ui.Image.named('test:Peppers') | |
mask_img.clip_to_mask() | |
img.draw() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FooBar.pdf | |
================================================================================ | |
p. 4 | highlight | yellow | |
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor | |
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis | |
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. | |
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu | |
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in | |
culpa qui officia deserunt mollit anim id est laborum. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on https://gist.github.com/4063716 | |
# | |
# Provides a simple shell with basic | |
# commands for dealing with files and | |
# directories. | |
# | |
# This script will try and prevent | |
# unsafe file operations outside of | |
# Documents directory. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding: utf-8 | |
# Original script by Federico Viticci: | |
# http://www.macstories.net/reviews/fantastical-for-iphone-review/ | |
# Modified to work better with international characters | |
import webbrowser | |
import clipboard | |
import urllib | |
import console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Variation of the 'Basic Scene' template that shows every | |
# touch in a different (random) color that stays the same | |
# for the duration of the touch. | |
from scene import * | |
from colorsys import hsv_to_rgb | |
from random import random | |
class TouchColors (Scene): | |
def setup(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scene import * | |
from time import time | |
import sound | |
MAX_DOUBLE_TAP_DELAY = 0.25 | |
class DoubleTapScene (Scene): | |
def setup(self): | |
self.last_touch_up_time = 0 | |
self.double_tap_start_time = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Demo of how to generate a list of prime numbers and cache them | |
# in a data file for fast access (using the marshal module). | |
def gen_primes(n): | |
# Source: http://code.activestate.com/recipes/366178-a-fast-prime-number-list-generator/#c19 | |
s = range(0, n+1) | |
s[1] = 0 | |
bottom = 2 | |
top = n // bottom | |
while (bottom * bottom <= n): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import canvas | |
canvas.set_size(512, 512) | |
from_point = (10, 10) | |
cp1 = (40, 200) #control point 1 | |
cp2 = (350, 50) #control point 2 | |
to_point = (300, 300) | |
# Draw the actual curve: |
OlderNewer