Skip to content

Instantly share code, notes, and snippets.

@gwthompson
gwthompson / infinite_generator_neopixel.py
Created May 31, 2019 15:25 — forked from seantibor/infinite_generator_neopixel.py
uses the Adafruit wheel function and a generator to iterate back and forth over a range of colors.
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.
@gwthompson
gwthompson / markdown-details-collapsible.md
Created September 5, 2019 16:11 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

A collapsible section with markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets
@gwthompson
gwthompson / AutoLayout.md
Created February 4, 2020 20:59 — forked from NSExceptional/AutoLayout.md
The best damn AutoLayout guide I've ever seen

ℹ️ This article is also available on his blog.


Fundamentals

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).
@gwthompson
gwthompson / Slack Status.js
Created May 13, 2020 19:46 — forked from simonbs/Slack Status.js
Peforms OAuth flow against Slack and sets a Slack Status. Meant to be used with Shortcuts.
// 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.
@gwthompson
gwthompson / Battery.py
Created September 22, 2020 18:43 — forked from ColdGrub1384/Battery.py
A battery widget for the Home Screen monitoring in background.
# 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
@gwthompson
gwthompson / widget-html-css-scriptable-jobs.js
Created September 22, 2020 20:05 — forked from dcatanzaro/widget-html-css-scriptable-jobs.js
Widget con HTML y CSS en Scriptable
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
@gwthompson
gwthompson / README.md
Created September 23, 2020 02:06 — forked from mattsson/README.md
Tour de France Standings Scriptable Widget for iOS 14

https://imgur.com/a/q8R5iNf

To use:

  1. Update iOS 14
  2. Install Scriptable app: https://scriptable.app/
  3. Add a new script and paste in the script code
  4. 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
  5. Configure the widget to use the Tour de France Standings script by long-holding on the widget and tapping Edit Widget
@gwthompson
gwthompson / Recycling.js
Created September 23, 2020 02:51 — forked from jiserra/Recycling.js
Scriptable widget for recycling days in NYC
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: green; icon-glyph: trash;
// This is the ID for your collection zone. I explain how to obtain this in the other recycling-data.md gist
let FID = REPLACE THIS WITH YOUR FID;
Date.prototype.addDays = function(days) {
var date = new Date(this.valueOf());
date.setDate(date.getDate() + days);
@gwthompson
gwthompson / Paintings.js
Created September 23, 2020 12:53 — forked from rsalzer/Paintings.js
Scriptable to show a random painting from the Metropolitan Museum of Art
//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);