Skip to content

Instantly share code, notes, and snippets.

Sean M. Tracey seanmtracey

Block or report user

Report or block seanmtracey

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View London DevRel Salon Code of Conduct.md

CODE OF CONDUCT

The London Devrel Salon, hereinafter referred to as the Event Organizers, are dedicated to providing a safe, respectful, comfortable, and harassment-free environment for all event participants.

Event Organizers expect that all participants, including delegates/attendees, speakers, volunteers, and guests, will conform to the following Code of Conduct.

UNACCEPTABLE BEHAVIOUR

Participants will not engage in unacceptable behaviour which includes, but is not limited to:

View node-red-pwa-example.json
[{"id":"657d785c.a755d8","type":"http in","z":"d7f421c3.87cf2","name":"","url":"/cinelist","method":"get","upload":false,"swaggerDoc":"","x":250,"y":240,"wires":[["683f655.3cdba9c"]]},{"id":"c8db0462.894fd8","type":"http response","z":"d7f421c3.87cf2","name":"","statusCode":"","headers":{},"x":860,"y":180,"wires":[]},{"id":"66fc158.8d674ec","type":"template","z":"d7f421c3.87cf2","name":"HTML / CSS","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n\t<meta content=\"text/html; charset=utf-8\" http-equiv=\"Content-Type\">\n\t<title>CineList</title>\n\t<link rel=\"shortcut icon\" href=\"https://cinelist-public-dev.herokuapp.com/favicon.png\">\n\t<style>\n\n @charset \"UTF-8\";\n /* CSS Document */\n\n *{\n -webkit-tap-highlight-color: rgba(0,0,0,0);\n box-sizing: border-box;\n }\n\n .inactive, [data-is-loading=false], [data-visible=false]{\n display: none !impor
@seanmtracey
seanmtracey / Word Counter Node Codes
Last active Jan 14, 2019
The code for the IBM Developer UK word counter tutorial
View Word Counter Node Codes
This is all of the code needed to follow the IBM Developer UK word counter tutorial.
@seanmtracey
seanmtracey / GlowOrbWordCounter.md
Last active Sep 24, 2018
A Node-RED flow that turns a glow orb different colors depending on how fast I'm talking
View GlowOrbWordCounter.md

Steps for use:

  1. Import the flow to a Node-RED instance
  2. Add credentials to the speech-to-text node
  3. Configure your MQTT node to communicate with your Gloworb / MQTT enabled device
  4. Click 'Deploy'
  5. Open up https://<YOUR_NODE_RED_HOST>/word-count. You'll be asked to enable your microphone, this will begin the capture of audio from your mircophone for counting.
  6. Once you enable the microphone, you can click the 'Start' button to stream the audio over web sockets to your Node-RED instance.
  • NB: If you hit the 'stop' button, you'll need to refresh the page to start streaming again, I haven't finished that bit of the code yet.
  1. Voila! If you're speaking at an acceptable rate, your glow orb will be green. If you're going a little fast, it will turn orange. If you're WWAAAYYYYY out, it will turn blue (because red is an alarming color for anyone to see.)
View Node-RED + Watson Assistant Details.md

Instructions for plugging a website into Watson Assisstant with Node-RED + WebSockets

Okie dokie, so you want to plug your website into Watson Assistant, well, here's how you can do that.

First, you'll need to set up a Node-RED server which can talk to Watson Assistant. The demo-flow.json contains a demo flow that will hook up a websockets endpoint to a Watson Assistant instance enabling you to talk to the Assistant instance with a web page.

  1. Copy the contents of demo-flow.json into your clipboard and then head to any Node-RED flow.
  2. Top right of the Node-RED UI, hit the hamburger menu and then hover over "import" and then select "clipboard" from the context menu that appears.
  3. In the dialog box that appears, paste the content of your clipboard and then click "import"
  4. A flow will appear in your workflow, click to place it, you now have a websocket connection configured to talk to Watson Assistant
@seanmtracey
seanmtracey / instructions.md
Created Sep 3, 2018
Instructions to clear CloudantDB Documents
View instructions.md
  1. First up, head to https://console.bluemix.net and find your Cloudant DB instance. Click on it to be taken to the service page.
  2. Next, click on the "Launch Cloudant Dashboard" button at the top-right of your screen. This will take you to the dashboard for your Cloudant DB instance
  3. You should be taken to the 'databases' view (if not, click on the icon on the far left of the screen that looks like stacked pancakes). Click the database that you would like to delete the records from
  4. A table with rows of your documents should appear.
  • If you only want to delete select documents from your database, click the individual checkboxes on the left-hand side of each row in the tabl
  • If you want to delete all of the documents in this view, clickbox just above the table on the left-hand side
  1. When you've selected some (or all) of your records, a trash can icon will appear at the top left of the table. Click it to delete the selecte rows.
@seanmtracey
seanmtracey / instructions.md
Created Sep 3, 2018
Instructions to clear CloudantDB Documents
View instructions.md
  1. First up, head to https://console.bluemix.net and find your Cloudant DB instance. Click on it to be taken to the service page.
  2. Next, click on the "Launch Cloudant Dashboard" button at the top-right of your screen. This will take you to the dashboard for your Cloudant DB instance
  3. You should be taken to the 'databases' view (if not, click on the icon on the far left of the screen that looks like stacked pancakes). Click the database that you would like to delete the records from
  4. A table with rows of your documents should appear.
  • If you only want to delete select documents from your database, click the individual checkboxes on the left-hand side of each row in the tabl
  • If you want to delete all of the documents in this view, clickbox just above the table on the left-hand side
  1. When you've selected some (or all) of your records, a trash can icon will appear at the top left of the table. Click it to delete the selecte rows.
View Hays Solutions.md

Hard

 Number( input.toString().split('').sort( (a, b) => { return a < b ? 1 : -1 } ).join('') )

Intermediate

const lower = 'abcdefghijklmnopqrstuvwxyz'.split('');
const upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('')
View Node-RED Web Component Ideas.md

Web components to hook up client-side applications to Node-RED nodes in a standardised way.

Rationale

Node-RED is incredibly good at letting people prototype their ideas without a great deal of programming knowledge. However, the dashboard, whilst great connecting service A -> C via. B, it doesn't lend itself especially well to being hooked up to a custom application running on said server in quite the same way.

I believe Web Components could allow for more web apps to be built and integrated with Node-RED nodes as seemlessly as creating a flow is now, but with a greater ability to customise that JS/CSS/HTML afford up-and-coming developers.

How would this work?

  1. A developer would drop a node onto the canvas, just as they always have (say, for a camera), and give it a unique name.
  2. The developer would include a <script> tag in a web page they are delivering from the same Node-RED instance
View gist:63c3b3220d50d0eb46757b8a595e883f
Array.from(table.querySelectorAll('tr')).map(tr => {tds = Array.from(tr.querySelectorAll('td') ); return `${tds[0].querySelector('input').value}=${tds[1].querySelector('textarea').value}` }).join('\n')
You can’t perform that action at this time.