Skip to content

Instantly share code, notes, and snippets.

View joshco's full-sized avatar

Josh joshco

  • Department of Redundancy Department
  • New York
View GitHub Profile
@joshco
joshco / coffee-machine-td.json
Created October 16, 2023 02:53
Coffee machine TD from wot.py
{
"description": "A smart coffee machine with a range of capabilities.\nA complementary tutorial is available at http://www.thingweb.io/smart-coffee-machine.html.",
"actions": {
"makeDrink": {
"description": "Make a drink from available list of beverages. Accepts drink id, size and quantity as input.\nBrews one medium americano if no input is specified.",
"output": {
"description": "Returns True/false and a message when all invoked promises are resolved (asynchronous).",
"properties": {
"result": {
"type": "boolean"
@joshco
joshco / sleep_scene_select.yaml
Created September 13, 2023 17:46
ESPHome DIY Scene Selector
esphome:
name: esphome-web-c9e248
friendly_name: widget2
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
@joshco
joshco / rgbvalues.py
Last active July 8, 2023 23:57
Example
#!/bin/env python
import math
keyvalue=32
colors = [ "RED", "BLUE", "GREEN", "YELLOW", "PURPLE", "PINK", "BROWN", "BLACK" ]
idx =int( math.log(keyvalue,2))
color = colors[idx]
@joshco
joshco / js__pKeS74-257df49e.md
Last active April 30, 2020 06:31
adv search box

On post pages, Menu Bar Search box doesnt open when search icon is clicked. (it works on main page)

Drupal.behaviors.advocateTheme... is only running on the main page.

If that is by design, the code that sets the click event listeners can be set in a document ready block instead of Drupal.behaviors... See Working Code below. (just like the section above it setting the load resize scroll event handlers)

(I'm using chrome on win10x64)

File

https://www.advocate.com/sites/advocate.com/files/advagg_js/js__pKeS74qEIK-ctkd14qdyisuErNkvLJuCt8aG79MHAg0__1ysaI47LG2Ste5LPPKcxkdjR4ne5qN72cTQSW23QPZk__sBAWPuKToWrtRrrp7wCojNXjukU8QlQoiaP2klXzo1k.js

@joshco
joshco / gist:e5fbf2b7167504fbc66b6ffc83b447cc
Created April 23, 2020 21:07
node-wot PORT and URL deployment issues
$ git push --force dokku pre-portfix:master
Total 0 (delta 0), reused 0 (delta 0)
-----> Cleaning up...
-----> Building thingpatrol from herokuish...
-----> Adding BUILD_ENV to build environment...
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
@joshco
joshco / README UI_and_Logging.md
Last active March 24, 2021 13:37
TablePress AutoImport Patch

Overview

This patch adds:

  • a function to wrap the WP calls to get a URL based source and sets a 30sec timeout.
  • More detailed status information in the plugin's WP Dashboard pane on why an autoupdate failed.
  • Logging information, and a logging function, which outputs debug information when WP_DEBUG is true to help troubleshoot.

Failure case (with a timeout)

Debug Log

@joshco
joshco / spoke_osdi.md
Last active April 4, 2019 20:23
Spoke OSDI Endpoint
@joshco
joshco / Vagrantfile
Created December 30, 2017 23:44
rubymine problem vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@joshco
joshco / GET Items
Created July 13, 2017 15:40
Optimized List Item Retrieval
// GET .../lists/1/items.json
{
"_embedded": {
"osdi:items": [
{
"_embedded": {
"osdi:person": {
"_links": {
"self": {
"href": "/people/64978",
@joshco
joshco / individual script get
Created June 20, 2017 05:09
Scripts collection
{
"origin_system": "VAN",
"name": "osdi_script",
"description": "OSDI Test Script",
"title": "osdi_script",
"summary": "OSDI Test Script",
"status": "Active",
"identifiers": [
"VAN:235196"
],