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 adafruit_circuitplayground.express import cpx | |
import time | |
def wheel(pos): | |
# Input a value 0 to 255 to get a color value. | |
# The colours are a transition r - g - b - back to r. | |
if pos < 0 or pos > 255: | |
return (0, 0, 0) | |
if pos < 85: | |
return (255 - pos * 3, pos * 3, 0) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
ℹ️ This article is also available on his blog.
Layout and Drawing are two different things:
- Layout defines only the positions and sizes of all views on screen.
- Drawing specifies how each view is rendered (how it looks).
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
// Variables used by Scriptable. | |
// These must be at the very top of the file. Do not edit. | |
// icon-color: pink; icon-glyph: user; | |
// In order to use the script, you must create a Slack app and install it on your workspace. Go here to create your app: api.slack.com/apps | |
// There's two important configurations you must make to the app: | |
// 1. Add the users.profile:write scope to the app. This scope is necessary to set a Slack status. | |
// 2. Add the following redirect URL, so Slack will redirect to Scriptable after authorizing. | |
// https://open.scriptable.app | |
// Run the script to grant your newly created app authorization to access your Slack account. After you've done this, you can use the script in Shortcuts. |
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
# Created with Pyto | |
import widgets as wd | |
import sf_symbols as sf | |
import sys | |
from datetime import time | |
from UIKit import UIDevice | |
from background import BackgroundTask | |
from threading import Thread |
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
const js = `(function (global) { | |
"use strict"; | |
var util = newUtil(); | |
// Default impl options | |
var defaultOptions = { | |
// Default is to fail on error, no placeholder | |
imagePlaceholder: undefined, | |
// Default cache bust is false, it will use the cache |
To use:
- Update iOS 14
- Install Scriptable app: https://scriptable.app/
- Add a new script and paste in the script code
- Add a medium-sized widget to your iPhone home screen by long-holding, tapping the Plus button in the top left and selecting Scriptable from the list of widget sources
- Configure the widget to use the Tour de France Standings script by long-holding on the widget and tapping Edit Widget
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
//Department ID = 11 is paintings ; use other if you wish | |
const url = 'https://collectionapi.metmuseum.org/public/collection/v1/search?hasImages=true&departmentId=11&q=Painting' | |
const req = new Request(url) | |
const res = await req.loadJSON() | |
const max = res.total-1 | |
console.log("Max: "+max); | |
const min = 0 | |
const random = Math.floor(Math.random() * (max - min + 1)) + min | |
console.log("Random: "+random); |
OlderNewer